Created
December 31, 2018 03:47
-
-
Save 1f0/961cf11fedd7ad4ae63cf3868ded7dd9 to your computer and use it in GitHub Desktop.
rm not match files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sed -e 's,^,^,' -e 's,$,$,' filelist > newfilelist | |
cd your_directory | |
ls | egrep -vf newfilelist | xargs -n 1 echo rm > rmscript | |
#If the files have spaces in their name (if the files have the " in the name that will not works) : | |
ls | egrep -vf newfilelist | sed 's,^\(.*\)$,rm "\1",' > rmscript |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment