cp multiple files to multiple directories
Hello
I thought I would find a solution easily but alas! The challenge: I need to copy *.cnv files from a number of folders (named Afr100, Afr101 etc and their sub-folders) to new folders that have the same name as the source. For example, from ~/data/Afr121/Processed/*.cnv to ~/newdata/Afr121. I don't want to have to mkdir for each folder (Afr100 to Afr132) and then copy the .cnv files one folder at a time. How difficult is this challenge? |
You can use rsync with the proper include and exclude options:
Code:
rsync -av --include='*/' --include='*.cnv' --exclude='*' data/* newdata |
In case you cannot live with dummy directories... ;) here is a simple alternative:
Code:
for file in $(find data -name \*.cnv) |
All times are GMT -5. The time now is 05:13 PM. |