Copy multiple files with same name from different directories
I regularly do this. So I automated it.Below is a small simple script for copying files which are present in two different directories but without same names into a single directory with having name collision.
#!/usr/bin/sh
for i in `find <source_dir_path> -type f`
do
new=`echo $i|nawk -F"/" '{split($NF,a,".");print "<target_dir_path>"a[1]"_"$(NF-1)"."a[2]}'`
cp $i $new
done
.png)







I am a software programmer working in India. I usually like to blog in my free time.