move duplicate .mp3 file into ‘trashcan’ directory, bash >= 4.0

Home   »   move duplicate .mp3 file into ‘trashcan’ directory, bash >= 4.0

$(shopt -s globstar)

if ! [ -d trashcan ]; then
	mkdir trashcan
fi

for file in */**/*\ 1.mp3;
do
	if [ -f "${file/ 1.mp3/.mp3}" ] ; then
		echo $file
		mv "$file" trashcan/
	fi
done

Leave a Reply

Your email address will not be published. Required fields are marked *