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

将文件移动到Powershell上方的目录,powershell,Powershell,我有以下途径: 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 我想将其提升一个级别,以匹配以下内容: C:\Customer\Morri\ft.txt C:\Customer\Morri\dropbox\fed.xslx C:\Customer\Tori\ss.txt C:\Customer

我有以下途径:

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
我想将其提升一个级别,以匹配以下内容:

C:\Customer\Morri\ft.txt
C:\Customer\Morri\dropbox\fed.xslx
C:\Customer\Tori\ss.txt
C:\Customer\Tori\dropbox\sed.xslx
我该怎么做


因此,除了M&T级文件夹外,整个结构应该保持不变(这也可以称为任何实际名称)。

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

Get-ChildItem .\*\*
$dir = 'C:\Customer'
Set-Location $dir
Get-ChildItem .\*\* |
Move-Item -Destination .\ -Verbose
这确实符合我的要求,但现在我想删除空文件夹M和T(我刚刚从中移动了文件和子文件夹的文件夹)


我如何才能让它意识到我只想删除这些内容?

到目前为止,您都做了哪些尝试?请向我们展示一些代码,并尝试提供一个新的解决方案。