I have a CSV file that is nothing more then a list of files. I would like to use that file in a command where a file name does not match a file in the csv file.
Here is the code I am using today:
$DoNotDelete = "1099|1099 CACs|4 Color Initiative|2006-0928|4th instance|ACSS Collatecral|AOPC Migration|Appendix C 2014 Promotional Programs|..."
This is a partial list of what is in the csv file. The file contains 72 items - and currently I have them all in the script in the above format.
This is where I call the DoNotDelete variable and use it to not delete the files in the list:
get-childitem "E:\Verizon" -recurse | where {$_.fullname -notmatch $DoNotDelete}| where-object {$_.lastaccesstime -le $ActiveDate -and -not $_.psiscontainer} | remove-item -force -whatif
I am struggling to figure out how to do this - or even if it is possible to do this. It's cumbersome to have to add to the script every month - the list of files is evaluated and usually added to by other users.
I guess you could consider me a newbie - I am self taught and have written several Powershell scripts that are working.
Thank you