Speak now
Please Wait Image Converting Into Text...
Embark on a journey of knowledge! Take the quiz and earn valuable credits.
Challenge yourself and boost your learning! Start the quiz now to earn credits.
Unlock your potential! Begin the quiz, answer questions, and accumulate credits along the way.
General Tech Bugs & Fixes 2 years ago
Posted on 16 Aug 2022, this text provides information on Bugs & Fixes related to General Tech. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.
Turn Your Knowledge into Earnings.
I'm writing a bash script that needs to fetch all *_out.csv from a directory, on a remote server. All these files are several directories deep inside of another directory. So for instance, say the directory is called ox_20190404/. I can find all my files by going:
*_out.csv
ox_20190404/
find ox_20190404/assessment/LWR/validation -type f -name "*_out.csv"
This question answers part of my question, but since I don't want to copy the directory in it's entirety I need to figure out how to implement the above code. Suppose I start with this:
$ dir="/projects/ox/git" $ server="myusername@server" $ scp $server:$dir/$(ssh $server 'ls -t $dir | head -1') .
How would I grab the f="https://forum.tuteehub.com/tag/file">files I need from there?
The last part of my question wonders if there is a way to then take all the copied f="https://forum.tuteehub.com/tag/file">files and place them in the same f="https://forum.tuteehub.com/tag/file">file path and directory they were in on the remote server.
I've adjusted some of your variable names a bit.
Surely there are better ways to do this than something dangerous like parsing the output of ls, but see whether this works for you:
$ pth="/projects/ox/git" $ server="myusername@server" $ dir="$(ssh $server "ls -t \"$pth\" | head -1")" $ mkdir -p "$pth/$dir" $ scp -p $server:"$pth/$dir"/'*_out.csv' "$pth/$dir"/
Once dir has been set to the newest remote directory, mkdir -p is used to ensure that the same directory name exists locally. Then scp the files into a local directory with the same path and name as the remote directory. I was looking for an rsync solution, but couldn't think of one.
dir
mkdir -p
scp
No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.
General Tech 9 Answers
General Tech 7 Answers
General Tech 3 Answers
General Tech 2 Answers
Ready to take your education and career to the next level? Register today and join our growing community of learners and professionals.