Copying a single file to multiple directories
I want to copy a single file to a directory and all the subdirectories contained within the main directory. I want to be able to copy a file into about 10,000 folders, I need a quick way to do this, thanks.
|
i dont think there is any standard command for copying to multiple locations.
u may try making a shell script |
I'm not familiar with creating shell scripts, could anyone help me create one for this job, thanks.
|
This script should work.
I dont know whether i could make this script more simpler, expecially that text filtering part with awk, there could be simpler tools for that! #!/bin/bash #rec_copy.sh #Usage: # rec_copy.sh input_file target_dir # copies 'input_file' recursively to all directories starting at 'target_dir' if [ -z $2 ]; then echo "usage: $0 input_file target_dir" exit fi #for i in $(ls -R $2| grep :$ | awk -F":" '//{print $1}' ) for i in $(ls -R $2 | awk -F":" '/:$/{print $1}' ) do cp $1 $i done |
All times are GMT -5. The time now is 06:46 AM. |