Powershell脚本,用于将包含子文件夹的文件和文件夹从一个位置移动到x天以外的另一个位置

问题描述:

我目前正在寻找一个脚本,可以将文件从文件夹和子文件夹从一个位置移动到另一个位置。



来源:网络UNC路径

目的地:本地服务器(脚本将运行的地方)




以下是我开发的powershell脚本及其不符合我的要求。子文件夹中的文件没有被移动。



i无法进一步自定义....

I am currently looking for a script which would move the files from folders and subfolders from one location to another.

source: Network UNC path
Destination: Local server (where the script would run)


Below is the powershell script, which I had developed and its not working as per my requirement. The files in subfolders are not getting moved.

i am unable to customize it further....

get-childitem -Path "\\servername\location" |
    where-object {$_.LastWriteTime -lt (get-date).AddDays(-10)} | 
    move-item -destination "C:\Dumps"



非常感谢任何进一步的帮助。


Any further help is highly appreciated.

_。LastWriteTime -lt(get-date).AddDays(-10)} |
move-item -destinationC:\ Dumps
_.LastWriteTime -lt (get-date).AddDays(-10)} | move-item -destination "C:\Dumps"



非常感谢任何进一步的帮助。


Any further help is highly appreciated.


Add -Recurse 选项 get-childitem