Powershell - 将文件夹及其所有内容移动到另一个文件夹

问题描述 投票:0回答:1

我有一个文件夹 H:\FAKTURA,里面有一堆文件夹。 在同一个文件夹中,我有一个名为“ARKIV”的文件夹。 我想将此文件夹中的所有文件夹移动到“ARKIV”文件夹中。

我有以下情况,但没有任何反应,没有错误,没有移动文件夹/文件

 $current_logfiles = "H:\FAKTURA\"
 $destination = "H:\FAKTURA\ARKIV\"

 if ((Test-Path -Path $destination)) 
 {
     Move-Item -Path $current_logfiles -Destination $destination - 
     Exclude "H:\FAKTURA\ARKIV"  -force
 }

我在这里缺少什么吗..?

powershell file directory move
1个回答
0
投票

你说 H:\FAKTURA\ARKIV 这意味着 Test-Path -path $destination 将返回 True。问题是,您随后否定结果 !(Test-Path -path $destination) ,该结果将返回 False,因此 If 语句将不起作用。删除'!()'

© www.soinside.com 2019 - 2024. All rights reserved.