You are not logged in.
Pages: 1
I am trying to locate all files with *.ars is all subfolders of a directory and move the a folder
I have tried:
mv `find . -name "*.ars"` SASSI5
but I get the following errors
mv: rename ./EAST/ROCK/EUS to SASSI5/EUS: No such file or directory
mv: rename ROCK to SASSI5/ROCK: No such file or directory
mv: rename M5.5 to SASSI5/M5.5: No such file or directory
mv: rename 0-50/A-GRV330.CTH.F/A-GRV330.CTH.F-139.ars to SASSI5/A-GRV330.CTH.F-139.ars: No such file or directory
it seems to be trying to recreate the subdirectories that the files were in in my new folder.
Any help...I am sure this is simple
Thanks
Offline
You can see what mv thinks of the files it has to move: they don't end in .ars (except the last one) So there are spaces in the filename.
Try it with IFS set to newline.
IFS="
"
mv `find . -name "*.ars"` SASSI5
If it still doesn't work then use the -exec switch of find and something like mv '{}' SASSI5 \;
Offline
or
find . -name "*.ars" -exec mv "{}" absolute_path_destination \;"
Offline
Thanks.
Another question. I hundreds of files with the extension "smooth". They are all located in several different subfolders (139.P, 151.P, 158.P). Of each subfolder, there are several of those...so I have say 10 139.P folders, 10 151.P folders, etc.
I would like to take all of the "smooth" files from all of the 139.P folders and place them in one folder.
Offline
Or maybe more easily...if I dump all of the filenames w/ extentsions into a file:
./WEST/ROCK/WUS ROCK M6.5 100-200/158.P/SMOOTHED/SOD015-5.RSsmooth
./WEST/ROCK/WUS ROCK M6.5 100-200/158.P/SMOOTHED/SON033-5.RSsmooth
./WEST/ROCK/WUS ROCK M6.5 100-200/158.P/SMOOTHED/SOR315-5.RSsmooth
./WEST/ROCK/WUS ROCK M6.5 50-100/139.P/SMOOTHED/A-CSH090-5.RSsmooth
./WEST/ROCK/WUS ROCK M6.5 50-100/139.P/SMOOTHED/A-MAL270-5.RSsmooth
./WEST/ROCK/WUS ROCK M6.5 50-100/139.P/SMOOTHED/A-ORR090-5.RSsmooth
./WEST/ROCK/WUS ROCK M6.5 50-100/139.P/SMOOTHED/A-RIV270-5.RSsmooth
./WEST/ROCK/WUS ROCK M6.5 50-100/139.P/SMOOTHED/AMB--X-5.RSsmooth
etc...
How can I then move all files w/ 139.P into a separate file..I can then copy and move the files with this list.
Offline
Your suggestion in post #5 is not needed.
You can match the entire filename with -path instead of -name.
find . -path '*/139.P/*smooth' -exec mv "{}" destination \;
Offline
Thanks that helps!!!
Offline
Pages: 1