-1

I have the following paths :

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

I would like to move it up a level to match the following:

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

How would I do this?

So the whole structure should be kept the same minus the M & T level folder (again this can be named anything in reality).

Laali
  • 3
  • 1
  • 3

1 Answers1

0

I have tried the following so far:

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

This does do what I require but now I would like to delete the empty folders M and T (the folders I have just moved the files and sub-folders from).

How would i get it to recognize that I would only like to delete these?

Laali
  • 3
  • 1
  • 3