I need to cleanup a folder periodically. I get a filelist which contains text, which files are allowed. Now I have to delete all files which are not in this file.
Example:
dont-delete.txt
:
dontdeletethisfile.txt
reallyimportantfile.txt
neverdeletethis.txt
important.txt
My folder do clean-up contains this as example:
ls /home/me/myfolder2tocleanup/
:
dontdeletethisfile.txt
reallyimportantfile.txt
neverdeletethis.txt
important.txt
this-can-be-deleted.txt
also-waste.txt
never-used-it.txt
So this files should be deleted:
this-can-be-deleted.txt
also-waste.txt
never-used-it.txt
I search something to create a delete command with an option to exclude some files provided by file.