I am trying to copy a features[30,55].R
script from my desktop into all the subdirectories that contain a file whose name is DONE
.
I tried the following command:
find . -name "DONE" -exec sh 'cp /Users/percyli/Desktop/features[30,55].R {}' \;
however, it gives you the following error:
sh: cp /Users/percyli/Desktop/features[30,55].R ./DONE: No such file or directory
sh: cp /Users/percyli/Desktop/features[30,55].R ./F3/F3-1/DONE: No such file or directory
where ./F3/F3-1
is one of the folders that contains the "DONE" file.
I also tried:
find . -name "DONE" -exec cp /Users/percyli/Desktop/features[30,55].R {} \;
It does not spit out an error but nothing actually happens after I run this command.
What might be the problem here and how can I fix this?
find . -name DONE -execdir cp /Users/percyli/Desktop/features\[30,55\].R . \;
as you can see the filename needs some escaping to avoid those "No such file or directory" errors. – don_crissti Mar 13 '16 at 21:38