The power of CLI - selective removal of files

finally took the time to tidy up my long-deserted online photo album. But the quest now is - remove unnecessary files, and reorganize them. I realise the good old gallery 1 web album made lots of *.sized.jpg and *.thumb.jpg, so going to every directory to remove them manually will take quite some time.

so i looked around for some CLi power. and i know even though it is simple for many of you there, i don't do that often so i have to relearn this :) it is at the end rather simple. my best find was to use find (he he a pun?). it does the job pretty well:

# find ./ -name *.sized.jpg

will return my a list of files matching the given name. so with a -exec extension will further do me good.

# find ./ -name *.sized.jpg -exec mv {} ../00_trash/ \;

i choose to use mv instead of rm has a reason. i don't want to "accidentally" remove anything i don't wish to. So i can always look into the 00_trash folder to review them before i hit "delete".

there are of course better ways to do this, like writing a bash script or so. but at this point it does good for me. 1.5GB of data will be cleaned up in 10 minutes. :)

May the force be with CLI :)