Cannot MOVE directory to another drive from XP command line

Posted on 2004-04-05
Medium Priority
Last Modified: 2008-10-13
I cannot use the 'move' command to move a directory from one drive to another from the Windows XP command prompt.

eg:   move c:\any_folder D:

results in the error message: "Access is denied." If copying to the same drive letter, it works fine. Is there a solution or workaround (eg: using xcopy and rmdir?). I want to copy all files and subdirs. I prefer using a simple command like 'move' because of it is safer than copying and deleting files.
Question by:elzmaddy
  • 3
  • 3
  • 3
  • +1
LVL 30

Expert Comment

ID: 10763287
I tried it on my XP machine and had the same results. You could use the Windows Explorer to cut and paste the directory from one drive to another.

An automated approach could use xcopy and rmdir:

xcopy /i c:\any_folder d:\any_folder
rd c:\any_folder /s /q

Good Luck,

Author Comment

ID: 10763819
It seems to work rather well. I use these commands for my particular application (in a batch file):

xcopy /I /S /V /F /H /-Y  c:\source d:\destination
rd c:\source /s /q

However, it is much slower than the 'move' command when copying to the same drive because data is written over. I believe all the move command does is change an entry in the file system table. That would explain why it cannot move to another disk.

But it works great. Thanks Steve.

Expert Comment

ID: 10765125
Even in Explorer cut and paste becomes a copy instead of move when used across drives.  M¢ did this on purpose to protect us from ourselves, guessing that we don't know the difference between move and copy but would never really want to take a file off a device.  

Bill must have stock in several hard drive manufacturing companies.

I'd stick to Steve's answer.
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.


Accepted Solution

4auHuk earned 300 total points
ID: 10765664
Moving files/folders between volumes is always sum of copy+delete. How can it be done otherwise?

Still it is silly behaviour for "move" to produce "Access denied" error. It seems that "move" really just tries to relink folder in fs table.

If speed is your concern you can check if source and destination are on the same volume or not and choose appropriate command ("move" or "xcopy+rd") within your batch.


Expert Comment

ID: 10766034
True, at the core move actually leaves files in place and changes the directories to reflect which one has it, far more kin to rename and removed from copy.

But when i drag a file off my thumb drive into "My Documents" and I choose not to hold down the Ctrl key for copy, Windows should be smart enough to know i do NOT want that thing still cluttering up my pocket.  It should do the copy, verify, and remove with no questions asked.  It does not do that and IMHO never will do as it should.  M¢ will never completely understand why we laugh and scoff at the "Press Any Key To Continue" prompt.

While we're ranting about random M¢ wrongness:
Who can we tell that while "My Documents" was wrong but marginally accepted, “My Music" and "My Pictures" and all the rest are TOTALLY unacceptable?
Under NT and 98, WinLogo+E opened Explorer (XP still does)
                          N jumped to "Network Neighborhood"  (not anymore)
                          RightArrow opened the list                  (not there yet)
                          First letter of the share name i wanted took me there.
                          4 keys, blindfolded, i got what i wanted
NOW i gotta lean on the M key for "My this" and "My that" and I can't just count em because the next "Something" that comes along will be jammed in there as "My Something"
They should not be forcing me to look at my screen or worse - use a mouse.
Yes, I can change each name, but that too should not be "My Job".

(\o/)  'nuff sed,

Expert Comment

ID: 10766760
Agree about drag and drop, but taking in account you do not like mouse, why not just Ctrl+X(C) --> Alt+Tab (or whatever) --> Ctrl+V? :)
As for navigation, well, what I usually do is Win+R \\server\share <Enter>. Moreover \\s will show all variants in drop-down menu as well as \\server\s

"My this", "My that" - all this is a part of "Desktop" metaphor that Explorer shell GUI uses. Obviously it is optimised for mouse, not for keyboard shortcuts.

P.S. "No keyboard found. Press any key to continue or DEL to Setup" <-- that's my favorite joke of the whole PC era :)

P.P.S. Sorry for offtopic every1

Author Comment

ID: 10768268
4aHuk: Your suggestion is probably the most efficient, although slightly more difficult to code. I should have mentioned that this process must be done at the command prompt (not Explorer), because my console-based application will figure out what folders to move, then it shells to the system and executes the commad.

I will probably stick to the simplest solution for now.

As for Explorer, I noticed sometimes when I cut and paste some files or folders to another location on the same disk partition, the process is instantaneous (just a relink). Other times, there is a progress bar and heavy disk access. I don't understand why.

Expert Comment

ID: 10771224
Is some of your partition using NTFS compression, and some of it not?

Are the areas that take more time using a different password for encrypting the files?  (none counts as different from any)

Author Comment

ID: 10771868
No, no compression or encryption.

Expert Comment

ID: 10772583
elzmaddy, i believe you should give credit to Steve

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

The following is a collection of cases for strange behaviour when using advanced techniques in DOS batch files. You should have some basic experience in batch "programming", as I'm assuming some knowledge and not further explain the basics. For some…
VALIDATING DATES One method of validating dates is to jam the date into the DATE command and see if it accepts it by examining the system's errorlevel value. A non-zero result indicates failure. A typical example might look something like the fol…
The video provides a quick and easy steps to migrate MBOX file to well known Outlook PST and Office 365. Besides this, it also supports and migrates more than 20 email clients of MBOX which include AppleMail, Opera, Thunderbird and SeaMonkey effortl…
If you are looking for an automated tool which can generate reports for Outlook emails and other items from PST file, then you can go for Kernel PST Reporter tool. The reports which are created by this tool are helpful to analyze and understand PST …

619 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question