DeaconFrost
[H]F Junkie
- Joined
- Sep 6, 2007
- Messages
- 11,582
I'm not the greatest at writing PowerShell scripts, nor am I successful in finding an answer via Google. If Robocopy is better for this task, I'd gladly use that instead.
I want to schedule a task to run a script (easy part). The script in question need to hit a path, say C:\Build\Packages\ and delete any file over 45 days in age. Here's the caveat. I want it to only delete files beyond the initial 10 files that are 45 days in age. So, if I the directory only has 4 files, none are deleted, regardless of age. If the directory has 15 files, and all are less than 45 days old, none are deleted.
Is that possible with a PS script?
I want to schedule a task to run a script (easy part). The script in question need to hit a path, say C:\Build\Packages\ and delete any file over 45 days in age. Here's the caveat. I want it to only delete files beyond the initial 10 files that are 45 days in age. So, if I the directory only has 4 files, none are deleted, regardless of age. If the directory has 15 files, and all are less than 45 days old, none are deleted.
Is that possible with a PS script?