I have a .bdf file inside subfolders. All the .bdf have the same name: Loads.bdf
Example:
/home/user/folderxx/folderxxx/Load.bdf
/home/user/folderxx/folderxxx/Load.bdf
I need to find (and copy to a new folder) all Load.bdf files and rename them with its path name.
Example:
After the intended operation, it should show something like this.
folder001_folderAAA_Load.bdf
folder002_folderBBB_Load.bdf
Best Answer
I would use the
mcp
tool from themmv
("multiple move") package for that:The
#1
,#2
etc. in the second string will be replaced by the contents of the corresponding 1st, 2nd etc. wildcard from the first string. Note that the path is in single quotes so that the wildcards are interpreted bymcp
, not by the shell.With the command shown, the files will be copied to the current directory. If you replace
mcp
withmmv
, the files will be moved instead.