Currently I'm using the command in cron
to make copy of *.data
from source to target path:
find /source_path -name *.data -exec cp {} /target_path \;
The source structure is:
/source_path/category1/001.data
/source_path/category1/002.data
/source_path/category2/003.data
/source_path/category3/004.data
/source_path/categorya/005.data
/source_path/categoryb/006.data
After the above cron
command, the target will contain:
/target_path/001.data
/target_path/002.data
/target_path/003.data
/target_path/004.data
/target_path/005.data
/target_path/006.data
I need a one-line solution to replace my current cron command, so that after execution, the target will contain:
/target_path/category1_001.data
/target_path/category1_002.data
/target_path/category2_003.data
/target_path/category3_004.data
/target_path/categorya_005.data
/target_path/categoryb_006.data
To append sub-directory name as a prefix of the target filename.
Thanks.