I know this question has been asked several times, but I'm having issues getting it working. I'm a noob when it comes to programming so borrowing code is about the most I can do. I need a script that can delete files that are in a folder that are X days old, but also need to only delete ones that contain "XXX" in the file names. They have no file extensions. I've seen a couple scripts on here that delete by date, and/or file extension but cant seem to get it working where it looks for certain characters. If anyone could help me out I would forever be in your debt.
Asked
Active
Viewed 1,918 times
0
-
Thought about renting a coder? – rrirower Feb 06 '15 at 16:48
1 Answers
2
This may be one of the questions that you viewed: Delete files older than 15 days using PowerShell
If you use one of the listed solutions that uses Get-ChildItem
to get files of a specified age, add -Filter *XXX*
to the Get-ChildItem
command to limit the results to files that contain "XXX" in the file name.
-
I did see that script but Im having issues getting that one to delete any files that are not set to 0 days. The files have a date modified of 2011 so they plenty old enough for the script. Im moving the files to a new folder for testing but they are not deleting, with just that script. – user1210394 Feb 09 '15 at 22:50