18

Hi there i'm using the windows 7 'move' command like so:

move /Y "C:\old.sub.folder\folder.i.want.to.move" "F:\new.sub.folder\folder.i.want.to.move"

and i keep getting an 'accessed denied' error yet i have full permissions and the folder i'm trying to move isn't open or being uses?

a random example trying to move one empty folder to another: http://puu.sh/2Rx6b.png

any ideas?

thanks

steve
  • 225
  • 1
  • 3
  • 7

3 Answers3

21

Or you could try robocopy with /MOVE argument:

robocopy C:\old\folder F:\new\folder /E /MOVE
Razvan
  • 2,436
  • 18
  • 23
  • Does robocopy /move move the files the same way the move command or explorer does, or does it copy and then delete? I get access denied when using os.system in python with the move command (although I think Python can move files without having to run system commands). I changed it to robocopy and it's taking a while. – user324747 Jul 14 '16 at 04:22
  • 7
    no, it doesn't. `move` doesn't touch the file itself, it only changes the file allocation table. This is why `move` can't move a file to another drive. Any move to another drive *must* make a copy – Stephan Jul 14 '16 at 07:51
  • does it delete each file after copying, or deletes them all after finish ? if 2nd, is with cmd a way to achieve 1st, without cmd loop ? – irvnriir Sep 06 '21 at 10:38
5

Syntax is:

MOVE [/Y| /-Y] [Drive:][Path]Folder1 Folder2

That means, you can rename one folder, but you cannot "move" contents to another drive.

I'm afraid, you have to copy your source-folder to the destination-folder (xcopy) and then delete the source-folder

Stephan
  • 53,940
  • 10
  • 58
  • 91
  • 1
    i don't understand though why can the move command move files but not folders? isn't there a command to move the folder? i don't mind using a separate exe for this if need be :) – steve May 12 '13 at 12:05
  • 2
    @Stephan copy/delete takes *ages* when you're moving many gig. It also wastes your hard drives life with the *completely* unnecessary duplicate data. To top it off, it probably fragments your filesystem. – jozxyqk Mar 23 '14 at 07:04
  • 1
    @jozxyqk: the OP wants to move from C: to F:. I don't know how to to that without transferring the data. – Stephan Mar 23 '14 at 07:14
  • @Stephan aah, fair point. I've just hit this issue and want to move on the same drive. – jozxyqk Mar 23 '14 at 07:15
  • 1
    @jozxyqk: Then `move` is the right way to do it for you. It only changes FAT-Entries without moving the files. (that's why it don't work from one drive to another) – Stephan Mar 23 '14 at 07:18
  • 1
    @Stephan That's exactly what I'm after but I'm having some [issues replacing/merging](http://stackoverflow.com/questions/22588225/how-do-you-merge-two-directories-or-move-with-replace-from-the-windows-command) when folder names match – jozxyqk Mar 23 '14 at 07:37
  • I am moving files to the same drive and getting this error. I tried robocopy as suggested by Razvan and not sure if that's moving or copying and deleting. – user324747 Jul 14 '16 at 04:26
-1

Best way for any access related issue is : Add a new principal "Everyone", give complete access and then enable inheritance. Kaboom !!! all access issues resolved/.

Steps:

  1. Go to properties of file > Security tab > Advanced Button.
  2. Under Permissions tab> Add > Select a principal > Type "Everyone" > Click "Check Names" button > Everyone written on object name will be recognized> CLick "ok". Please attach below reference, enter image description here
  3. select all "Basic Permissions"
  4. Click "OK"
  5. Select "Enable Inheritance" on "Advanced Security Settings>Permissions"