I want do delete all files with a specific extension (.xsl) whose names are not contained in another file. That is, if I have a file like
a.xsl
b.xsl
c.xsl
And a directory structure like
./a.xsl
./d.xsl
./folder1/b.xsl
./folder1/folder2/c.xsl
./folder1/folder2/e.xsl
I want to be able to delete d.xsl and e.xsl, but not a.xsl, b.xsl, or c.xsl. Target shell is BASH.
Something like this (Not tested):
where file1 is the file containing the list of file entries.
${fn##*/}This removes everything till the last slash giving the filename alone. This isgrepped against the file and if not resent, deleted.