Powershell脚本,用于将包含子文件夹的文件和文件夹从一个位置移动到x天以外的另一个位置 [英] Powershell script to move files and folders including subfolders from one location to another older than x days
本文介绍了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
这篇关于Powershell脚本,用于将包含子文件夹的文件和文件夹从一个位置移动到x天以外的另一个位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文