Link to home
Start Free TrialLog in
Avatar of namerg
namergFlag for United States of America

asked on

How to move files and folders into a folder that is part of the same folder tree ?

Hello, I have the following code but i am getting access denied.

I need to move everything from "C:\ArchiveDocs\DocImageExports\Servicing" into "C:\ArchiveDocs\DocImageExports\Servicing\Old"

Move-Item -Path "C:\ArchiveDocs\DocImageExports\Servicing" -Destination "C:\ArchiveDocs\DocImageExports\Servicin
g\Old"

Open in new window


Error:
Move-Item : Access to the path 'C:\ArchiveDocs\DocImageExports\Servicing' is denied.

Open in new window


Thanks for your help
Avatar of aikimark
aikimark
Flag of United States of America image

With that statement, you are trying to move a folder into a sub-folder.  Do you really want to move all the files into the sub-folder?
Avatar of namerg

ASKER

Yes. Into the sub-folder "Old"
Avatar of Mike McCracken
Mike McCracken

You can't move a folder into a subfolder.  You have to specify the files in the folder and move them into the subfolder.

mlmcc
SOLUTION
Avatar of aikimark
aikimark
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of namerg

ASKER

That script does not nothing. :(
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of namerg

ASKER

The code did the requested question