News:

The Latest electronic and computer Tips that work!

Main Menu

Power shell move file to different directory with dates

Started by branx86, May 25, 2025, 08:04:16 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

branx86

Power Shell commands

$source = "\\TRUENAS\LargeDrive\Satdump Files\Live_IMG"  -Server IP or name   
$source = "D:\videos"  -Drive letter
$destination = "\\TRUENAS\LargeDrive\Satdump Files\Live_IMG"  -Server IP or name
$destination = "C:\video\files"  -Drive letter
$date = Get-Date "01/05/2025"
date needs to before file was created to work.
dir $source | %{ dir $_.FullName | ?{ $_.LastWriteTime -gt $date } | Copy-Item -Destination $destination -Recurse -Force }