Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Move files to a new folder older thand 7 days

$
0
0

Hi,

Need some help.

Below PS script to move files older than 7 days does not work and ends with error

$Source_path = "D:\07" 
$max_days = "-7"  
$curr_date = Get-Date 
$Move_date = $curr_date.AddDays($max_days)  
Get-ChildItem $Source_path  | Where-Object { $_.LastWriteTime -lt $move_date } | move-Item $source_path "d:\temp"


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>