[英]Read a file and then based on file content names, move the file from one folder to another using Powershell script
[英]Move folder content from one directory to another
我有一個修補匠,希望將幾個用戶本地文件的內容移動到服務器上的新目錄。
從c:\\users\\%username%\\appdata\\roaming\\filezilla
移到C:\\users\\$username.mydomain\\appData\\roaming\\filezilla
我該怎么做? 批處理文件,vb腳本,電源外殼? 我需要快速簡便的方法來基本上復制內容。
就像是
for /d %%U in (C:\Users\*) do (
robocopy /MOVE "%%U\AppData\Roaming\Filezilla" "C:\Users\%%~nU.mydomain\AppData\Roaming"
)
也許?
我同意Joey的看法, robocopy
可能是這里最好的解決方案。 您也可以在PowerShell中使用它:
$subFolder = "AppData\Roaming\Filezilla"
Get-ChildItem "C:\Users" | ? { $_.PSIsContainer } | % {
$src = Join-Path $_.FullName, $subFolder
$dst = Join-Path $_.FullName + ".mydomain", $subFolder
robocopy $src $dst /move /e
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.