There are certain files under a folder 'ABC' and the entries for these files are there in another file(fname) under a different folder 'XYZ'. I want to compare the folder contents(ABC) with
the file(fname) contents and delete the mismatching / non-existing ones from the file, fname.
This deletes the files from the folder after comparison.
to be more specific about my problem, if
abc
bar
baz
are the files under 'ABC', the same entries(only entries) exist within files.txt under XYZ. In case, files.txt under XYZ has additional entries
def
foo
apart from abc, bar and baz, then after comparison, only the additional two entries:def and foo need to be removed from files.txt. The contents of 'ABC' should remain untouched.
the files under ABC get added to fname. entries from fname get deleted after the files get processed and files under ABC get renamed. So while fname gets emptied after a while, entries might pile up if a mismatch happens. this shouldn't occur. hence the reason for comparison and deletion