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

move file types over a certain date (beginner)

$
0
0

I'm trying to move all pictures over a definable date to a certain folder.

Here's my script so far - 

##Archive files that are older than a certain date

$date = "01/12/2013"

[array]$OldestFileImport = get-childitem "*.jpg" | where-object {$_.LastWriteTime -le [datetime]::$date}
##$OldestFileImport.count


move-item $OldestFileImport -Destination "C:\users\USER NAME\pictures"

I have copied elements of that, as I'm not really sure why / when you're meant to use variables that have the $_Text format rather than the $Text... I don't really get that. 

Apparently the path created by this is null... But I don't really know why. 

cheers!


Viewing all articles
Browse latest Browse all 21975

Trending Articles



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