I would remove all .jpg files in a directory, except those specified in a text file (eg test.txt).
This text file contains a list of some thousands of file names that exactly match those that I want to keep.
It is also essential that the only file names that include the symbol ^ be included for removal.
So in other words, all files without caret should not even be considered for removal by this script.
Below is the example of what is in the text file.
1022SS^BLACK.jpg
1022SS^BROWN.jpg
1022SS^DK GREEN.jpg
1022SS^GREY.jpg
1022SS^MAROON.jpg
1022SS^NAVY.jpg
Desired behavior:
KEEP_GREY.jpg
KEEP_BLACK.jpg
KEEP_1022SS^BLACK.jpg
KEEP_1022SS^BROWN.jpg
KEEP_1022SS^DK GREEN.jpg
KEEP_1022SS^GREY.jpg
KEEP_1022SS^MAROON.jpg
KEEP_1022SS^NAVY.jpg
DELETE_SS^BLACK.jpg
DELETE_SS^BROWN.jpg
DELETE_SS^DK GREEN.jpg
DELETE_SS^GREY.jpg
DELETE_SS^MAROON.jpg
DELETE_SS^NAVY.jpg
Need to keep the GREY.jpg and the BLACK.jpg because there is NO carrot symbol in the file name.
I found the following on this site that does exactly the opposite. But it might be a good start for someone who knows how to do this: How to delete files from a folder using a list of file names in windows?