我开发了一个PowerShell脚本,它的工作非常好。唯一的挑战是子文件夹中的文件没有移动到目标。
get-childitem -Path "\\servername\location" |
where-object {$_.LastWriteTime -lt (get-date).AddDays(-31)} |
move-item -destination "C:\Dumps"
我无法进一步自定义脚本。
不要浪费你的时间试图在PowerShell中重新发明robocopy
。
robocopy \\servername\location C:\Dumps /e /mov /minage:31
简化上述内容
robocopy A:\ B:\ /MIR /minage:31
A:\是你的来源B:\是你的目的地
我需要一个快速的衬垫,将所有数据从一个驱动器移到另一个驱动器上。这对我很有用:
Get-ChildItem“E:” - Recurse | Move-Item -Destination“G:”