Skip to content

Instantly share code, notes, and snippets.

@granolocks
Created April 7, 2017 20:47
Show Gist options
  • Save granolocks/eed53d49ee5c53b366e4ea737b353769 to your computer and use it in GitHub Desktop.
Save granolocks/eed53d49ee5c53b366e4ea737b353769 to your computer and use it in GitHub Desktop.
delete files out of 'UNSORTED' directory that are sorted into other directors that are a peer to UNSORTED
mkdir TO_DELETE
for i in $(ls UNSORTED )
do
x=$(find . -type f -name $i | grep -v UNSORTED)
[[ '' != $x ]] &&\
echo $x &&\
echo UNSORTED/$i &&\
mv UNSORTED/$i TO_DELETE
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment