One of the module which was done has to be copied to many directories say roughly around 50 inner directories. I did that by replicating it, but when i tested it i found that I have to change a file in all the 50 directories. I knew there is definitely a way out which can do this job easily and did some googling and used the bash script to write a small program which will do a small wonder for me.
The below bash script will loop thru all the directories (eg., abc, def, mmm ) and copies a file from turn/site/newfile.txt to all site directories which has been looped thru now.
#!/bin/bash
for directory in abc def mmm
do
echo $directory
cp trunk/site/newfile.txt $directory/site/somefile.txt
done
Note: While reading some sites, I found interesting bash shell script: copy only files modifed after specified date
Hope this might help you to save time.
No comments:
Post a Comment