Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Move files to different drive

$
0
0

Windows 2003 file server

Here is the script: (moves files that have not been accessed for 30 days to the drive E:\backup)

get-childitem P:\download -rec| where -FilterScript {$_.LastAccessTime -le [System.DateTime]::Now.AddDays(-30)} |move-item -destination "E:\backup"

issue: all files results end up in one single file backup even I specify E:\backup.

Questions: is there a way to move these files according to their source folder structures in the destination path E:\backup
ex:  source    Target
     P:\download\it\1.txt               E:\backup\it\1.tct
     P:\download\it\2\po.txt   E:\backup\it\2\po.txt
-------------------
Thank you. 


Viewing all articles
Browse latest Browse all 15028

Trending Articles



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