I have a directory structure something like:
/var/www/html/pictures/media0/01/test_01.jpg
/var/www/html/pictures/media0/01/test_02.jpg
/var/www/html/pictures/media0/01/test_03.jpg
/var/www/html/pictures/media0/01/test_04.jpg
/var/www/html/pictures/media0/01/test_05.jpg
I would like to remove all files from 01
except test_03.jpg
and test_05.jpg
by using a linux command, maybe rm
?
Any ideas?
The easiest way is to move the files you want to keep somewhere else, then delete the rest and move them back.
If this is for a script and you need something fancier I can write something using find
that will do it. Let me know.