|
|
|||||||
This is kind of a dumb one but for some reason I can't get this move command to work. Is there something wrong with this syntax? MOVE "\\SF1-FILE-1\USERS\@USERID\My Music\" "%SystemDrive%\My Music\" /c/h/r/s |
||||||||
|
|
|||||||
If you have NoMacrosInStrings active, that won't work.. Try this: Code: $Src = '"\\SF1-FILE-1\USERS\' + @USERID + '\My Music\"' $Dst = '"%SystemDrive%\My Music\"' 'Moving ' $Src ' to ' $Dst ? ; for debugging Move $Src $Dst /c /h /r /s ; note spaces Glenn |
||||||||
|
|
|||||||
NoMacrosInStrings is set to OFF as the default setting -The COPY command will work and will copy the "My Music" directory -Either of the MOVE commands above will not move the "My Music" directory. -I can rename or delete the "My Music" director so I don't think it's a rights issue. -Could there be something else with the syntax?? Thanks, Jeff |
||||||||
|
|
|||||||
Also, the debug seems to show the correct syntax: Moving \\SF1-FILE-1\USERS\username\My Music\ to C:\My Music\ Jeff |
||||||||
|
|
|||||||
Add this to your code... Code: $Src = '\\SF1-FILE-1\USERS\' + @USERID + '\My Music\' $Dst = '"%SystemDrive%\My Music\' 'Moving ' $Src ' to ' $Dst ? ; for debugging Move $Src $Dst /c /h /r /s ; note spaces 'Return code was ' @error ' this means ' @serror ? |
||||||||
|
|
|||||||
Thanks: Moving \\SF1-FILE-1\USERS\username\My Music\ to "C:\My Music\ Return code was 87 this means The parameter is incorrect Could it have something to do with the placement of quotes? |
||||||||
|
|
|||||||
Just noticed that there are missing quotes. $Src = '"\\SF1-FILE-1\USERS\"' + @USERID + '"\My Music\"' $Dst = '"%SystemDrive%\My Music\"' |
||||||||
|
|
|||||||
I think you went from missing quotes to weird-extra quotes.. You need a double-quote AFTER the FIRST single-quote and BEFORE the LAST single-quote, but none in the middle, so that your result is something like "\\sf1-file-1\users\JoeUser\My Music", not "\\sf1-file-1\users\"JoeUser"\My Music". Your debug message should show the double-quotes at each end of the string, with no double-quotes in the middle. An error-87 is an Invalid Parameter - probably due to the inconsistent quoting. Glenn |
||||||||
|
|
|||||||
Actually, I had corrected that and got a different error: My corrected syntax now is: Code: $Src = '"\\JA-FILE1\USERS\' + @USERID + '\My Music\"' $Dst = '"%SystemDrive%\My Music\"' Move $Src $Dst /c /h /r /s And the error is get now is... and this is verbatum: "Return code was 123 means tax is incorrect.ectory name, or volume label syn" what does this mean, and could you tell me where I reference the codes? Thanks again for your help. Jeff |
||||||||
|
|
|||||||
Looks like your messages are overwriting on your screen - add Code: $ = SetOption('WrapAtEOL', 'On') You can find most error codes on the MSDN web site, and some other web sites dedicated to helping decipher the codes. If you print your vars - Code: 'Move ' $Src ' to ' $Dst ? If that errors as well, try Code: If Exist($Src) 'Got source!' ? EndIf If Exist($Dst) 'Got destination!' ? EndIf Glenn |
||||||||
|
|
|||||||
OK... The MOVE command works fine if it uses drive letters. But once I change it to UNC it fails. I think the problem centers around UNC. I think this syntax is fine. Printing the vars looks correct with quotes. $Src = '"\\JA-FILE1\USERS\' + @USERID + '\My Music\"' But if I copy it directly to kix, I get an error. Even if I put a very simple path like "\\Server\share\folder\", I get the same error: "Return code was 123 this means The filename, directory name, or volume label syntax is incorrect" Is there some special syntax for UNC? I've never had an issue with UNC vs drive letter specifications. Thanks, JEff |
||||||||
|
|
|||||||
I'll try to reproduce it when I get to the lab.. Glenn |
||||||||
|
|
|||||||
UNC does not support LONG file names even when using quotes. You must use the SHORT name for the path. |
||||||||
|
|
|||||||
But wouldn't this be a "short" filename: "\\Server\share\folder\" The exact path was: "\\JA-FILE1\External\Test" And I still got the error. Do you mean spaces by long? Jeff. |
||||||||
|
|
|||||||
Closest match I could come up with.. Code: $S = 'c:\temp\test.txt' $D = '\\server\dev\misc\' + @USERID + '\My Test\' ; make sure folder exists.. MD $D ; move the file Move $S $D @SERROR ? Hmm - note that I DO NOT have embedded quotes in that test... When I put the quotes in and try again with test2.txt, I get: Code: G0PW01 - C:\temp>x.kix Move c:\temp\test2.txt "\\g0smp00\dev\misc\gbarnas\My Test\" The filename, directory name, or volume label syntax is incorrect. Ditch the quotes! Glenn |
||||||||
|
|
|||||||
Thanks. That works on my end as well. But when I try to move the entire folder "My Music" located on a UNC to the local drive, it does not work. I'm trying to move \\Server\Share\My Test to C:\My Test It seems that moving a file works but not an entire folder even with the switch /s even if I create the folder in the destination (MD) wehn it does not exist. However, "COPY" does work. So I tried to run the COPY command followed up with an "RD /s" which did not work. Perhaps the problem with the MOVE command has to do with removing the directory when it's finished? Jeff. |
||||||||
|
|
|||||||
I think I can do the following. Could you just help me with proper quotage around the var in the second line. How would you break out of the shell command to specify the $Src var? COPY $Src $Dst /s Shell "%ComSpec% /c RD $Src /S /Q" Jeff. |
||||||||
|
|
|||||||
That should be Code: Shell '%ComSpec% /c RD "' + $Src + '"/S /Q' Glenn |