Problem: 245,000 plus files residing in multiple recup_dir folders (output from photo_rec run) needing to be moved to a centralized folder for further recovery operations. All files are *.jpg files.
I have a text file named newlist1.txt that I have formatted in the following 4 ways. And to change to each variety, a good find/replace editor is essential. these script files are in a folder /disks/Keep/new-s1-recov. I know, I could have used just . to indicate where to mv the files, but initially, the scripts were in another folder, and the period would not have sufficed.
echo !(recov1/recup_dir.1033/f340010.jpg)| xargs mv -t /disks/Keep/new-s1-recov
echo !recov1/recup_dir.1034/f3442050jpg| xargs mv -t /disks/Keep/new-s1-recov
echo recov1/recup_dir.1034/f344208.jpg| xargs mv -t /disks/Keep/new-s1-recov
ls recov1/recup_dir.1034/f344208.jpg| xargs mv -t /disks/Keep/new-s1-recov
the last two examples, 3 & 4, work correctly when executed from the command line.
None of the examples work when I type
sh newlist1.txt
or
bash newlist1.txt
The thing is, I have over 245000 files that need to be moved. Why don't I use the file manager and do groups of several hundred at a time? Because the file manager is possibly the worst piece of software in Ubuntu 16.04.3. So, the command line is the preferable way of accomplishing this task. If I spend several days figuring out how to get it done like this, I'll consider it time well spent. I have wasted more than that on the file manager, waiting for the screen to come out of its seeming daze and finally show that the movement of several files has finally been accomplished.
The formatting above was taken from other examples I found at various times. I tried to adapt my problem to someone else's solution.
So, the question is: How do I format the 245000 lines (using nano texteditor which has a find/replace without having to add some additional software to gedit) and get it into a file which can be invoked by whatever command so that Ubuntu doesn't give me "TOO MANY ARGUMENTS" and die. It will submit each line as a command, and when it's done, it will execute the next line and so on until it's finished.
No comments:
Post a Comment