[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

using the "move" command via command line

Posted on 2007-10-04
4
Medium Priority
?
1,974 Views
Last Modified: 2012-08-13
Hello there - first off thanks for taking a look and my problem.
The situation: I'm writing one line of code to move data from a to b and I'm getting an syntax incorrect error. There's a good reason for doing this via command but I won't bore you with the details:)

Code: move G:\uploads\* H:\old users\departed employee images\
Error: The syntax of the command is incorrect

The G: drive is a internal hard drive and the H: is an external drive attached to the same system. All necessary rights have been setup/verified on the traversed directories. Spelling and directory paths have been ruled out. I ran the same command on some test directories in the root of C:\ without any trouble.  

Any input is much appciated!
0
Comment
Question by:CG_HD
  • 2
4 Comments
 
LVL 97

Expert Comment

by:Lee W, MVP
ID: 20015507
USE QUOTES for paths with spaces and use the full wild card specification:
move "G:\uploads\*.*" "H:\old users\departed employee images\"
0
 

Author Comment

by:CG_HD
ID: 20015589
Using "G:\uploads\*.*" "H:\old users\departed employee images\" I get a slightly different error...

Error: The filename, directory name, or volume label syntax is incorrect.

The filename,  directory name and volume label  (G: and H:) have been verified.

thoughts?
0
 
LVL 85

Accepted Solution

by:
oBdA earned 1500 total points
ID: 20016207
The internal move command will only work in the same partition, you can't move files or folders across partitions with it.
Either use robocopy from the W2k3 ResKit, which will (with the argument /mov) copy, then delete the source, or use two commands in your batch, one for the copy and one to delete the source:

copy  "G:\uploads\*" "H:\old users\departed employee images"
if not errorlevel 1 del /f /s /q "G:\uploads\*"

Windows Server 2003 Resource Kit Tools
http://www.microsoft.com/downloads/details.aspx?familyid=9d467a69-57ff-4ae7-96ee-b18c4790cffd&displaylang=en
0
 

Author Comment

by:CG_HD
ID: 20017905
Thanks oBdA - with a little tweeking that work perfectly...I appreciate everyone's help!
0

Featured Post

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Being a system administrator some time we require to do things remotely, one of them is installing software. Here I am going to tell you how to install software through wmic (Windows management instrument console). I am not at all saying that this i…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

872 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