I am trying to copy couple of directories and their files to another place. Each directory have 25-30 files and numbered accordingly, the problem I am facing is, I have to copy files numbered from 4-22 only and leave rest all.
I have written a code but its only copying one directory and its files and not others.
Overall /test1/step_1/prodinit_1....30 and I want to copy to /test2/step_1/prodinit_4...22
Expand|Select|Wrap|Line Numbers
- #!/bin/csh -f
- set dir1 = /home/rr/copy/test1
- set dir2 = /home/rr/copy/test2
- set step = 1
- set stepmax = 30
- set num = 4
- set nummax = 22
- mkdir $dir2/step_${step}
- echo $dir2/step_${step}
- while ($step < 30)
- cd $dir2/step_${step}
- cp -r $dir1/step_${step}/prodinit_${num}*.* $dir2/step_${step}
- echo "Copying file .."
- @ num = ${num} + 1
- if ($num == $nummax ) exit
- cd ..
- end
Thanks
Kumar