So by using some info from other threads on this site I have managed to get a script to copy files to another directory, then add the md5sum into the duplicate file names. However, I'm not fully satisfied as I'm still receiving a couple of BASH notifications when I execute the script which I could do with some help understanding/resolving. Firstly here is the script.
cp -r $dir1/* $dir2 cd $dir2 fdupes -r $dir2 | while read i; do bn="${i%.*}" ext="${i##*.}" md5=$(md5sum "$i" | awk '{ print $1 }') mv -v "$i" "${bn}_${md5}.${ext}" done The messages I am receiving when the script is run are:
md5sum: : No such file or directory mv: cannot stat ‘’: No such file or directory As I say, the script does seem to work, but any ideas on why I receiving these messages would be appreciated, as would any suggestion to tweak/improve the script. Thanks