Reputation: 905
I have to copy a list of files having the following pattern in the name: "_my_file" from sub-folders into one main folder. File names appear as the following:
A_my_file.txt
B_my_file.txt
C_my_file.txt
I used the following string but it does not work:
find . -name "*_my_file*" -exec mv "{}"./dest_fld \;
Upvotes: 2
Views: 1381
Reputation: 368954
Add space between "{}"
and ./dest_fld
:
find . -name "*_my_file*" -exec mv "{}" ./dest_fld \;
# ^
It would be better dest_fld
to be outside the currently directory. Unless, dest_fld
will be scaned too.
Upvotes: 3