Link to home
Start Free TrialLog in
Avatar of rtbywalski
rtbywalski

asked on

move files older than 30day with wildcard in path

I am trying to do a script in powershell that will move files older that 30 days to a sub folder.  The trick is I have a folder called users that has a sub under it for each users network share as a sub of that is a scans folder that each user scans to from our network scanners.   Since each user has their own private scan folder we want to age the data in there but as a safety net we want to be able to move it to a delete folder first so if they have not saved it where it really belongs that it will be easy for them to get back.  Example I want to move files from d:\users\*\scans  to d:\users\*\scans\delete that are older than 30 days.   then give them another 30 days there before we auto delete them.    I got the delete working but am having trouble with the move.

Avatar of Shift-3
Shift-3
Flag of United States of America image

Is using PowerShell an absolute requirement?  This particular task would be easier in a batch script with the forfiles command.
ASKER CERTIFIED SOLUTION
Avatar of Shift-3
Shift-3
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial