Avatar of Twhite0909
Twhite0909
 asked on

PowerShell Move Folders and Files

I use the Move-Item cmdlet currently to move files from my SFTP to other locations.  I now wantr to move the FOLDERS and FILES from the server to other locations.

Move-Item D:\LocationA\*    Grabs all files under the LocationA directory but does not move any subfolders residing here.
Powershell

Avatar of undefined
Last Comment
oBdA

8/22/2022 - Mon
oBdA

You need to specify the folder as source, not child items (with the \* at the end) to move th complete folder:
Move-Item -Path "D:\LocationA" -Destination "D:\LocationB"

Open in new window

Twhite0909

ASKER
OK TY for that now second part is I am moving it across volumes of different servers. I have a mapped network drive for the other servers location but this script gives an error " Move-Item : Source and destination path must have identical roots. Move will not work across volumes."
ASKER CERTIFIED SOLUTION
oBdA

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck