将文件移到Powershell上方的目录中

时间:2019-01-09 14:27:06

标签: powershell

我有以下路径:

grpc.Metadata

我想将其上移以符合以下条件:

C:\Customer\M\Morri\ft.txt
C:\Customer\M\Morri\dropbox\fed.xslx
C:\Customer\T\Tori\ss.txt
C:\Customer\T\Tori\dropbox\sed.xslx

我该怎么做?

因此,应将整个结构减去M&T级别文件夹,保持不变(同样可以在现实中命名为任何东西)。

1 个答案:

答案 0 :(得分:0)

到目前为止,我已经尝试了以下方法:

Get-ChildItem .\*\*
$dir = 'C:\Customer'
Set-Location $dir
Get-ChildItem .\*\* |
Move-Item -Destination .\ -Verbose

这确实满足了我的要求,但是现在我想删除空文件夹M和T(我刚刚从中移动文件和子文件夹的文件夹)。

我如何识别我只想删除这些内容?

相关问题