Page 1 of 1 1
Topic Options
#193505 - 2009-04-18 02:23 AM Move Command
jeff_eisenberg Offline
Fresh Scripter

Registered: 2009-02-26
Posts: 45
Loc: CA
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

Top
#193506 - 2009-04-18 04:07 AM Re: Move Command [Re: jeff_eisenberg]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4285
Loc: New Jersey
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
_________________________
Actually I am a Rocket Scientist! \:D

Top
#193528 - 2009-04-21 08:33 PM Re: Move Command [Re: Glenn Barnas]
jeff_eisenberg Offline
Fresh Scripter

Registered: 2009-02-26
Posts: 45
Loc: CA
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

Top
#193529 - 2009-04-21 08:37 PM Re: Move Command [Re: Glenn Barnas]
jeff_eisenberg Offline
Fresh Scripter

Registered: 2009-02-26
Posts: 45
Loc: CA
Also, the debug seems to show the correct syntax:

Moving \\SF1-FILE-1\USERS\username\My Music\ to C:\My Music\

Jeff

Top
#193530 - 2009-04-21 09:05 PM Re: Move Command [Re: jeff_eisenberg]
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
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 ?
_________________________
Today is the tomorrow you worried about yesterday.

Top
#193531 - 2009-04-21 09:36 PM Re: Move Command [Re: Gargoyle]
jeff_eisenberg Offline
Fresh Scripter

Registered: 2009-02-26
Posts: 45
Loc: CA
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?

Top
#193536 - 2009-04-22 02:06 AM Re: Move Command [Re: jeff_eisenberg]
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
Just noticed that there are missing quotes.


$Src = '"\\SF1-FILE-1\USERS\"' + @USERID + '"\My Music\"'
$Dst = '"%SystemDrive%\My Music\"'
_________________________
Today is the tomorrow you worried about yesterday.

Top
#193537 - 2009-04-22 02:39 AM Re: Move Command [Re: Gargoyle]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4285
Loc: New Jersey
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


Edited by Glenn Barnas (2009-04-22 02:41 AM)
Edit Reason: i before e except in wEird words
_________________________
Actually I am a Rocket Scientist! \:D

Top
#193539 - 2009-04-22 05:13 AM Re: Move Command [Re: Glenn Barnas]
jeff_eisenberg Offline
Fresh Scripter

Registered: 2009-02-26
Posts: 45
Loc: CA
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


Edited by Glenn Barnas (2009-04-22 05:39 AM)
Edit Reason: add code tags

Top
#193540 - 2009-04-22 05:45 AM Re: Move Command [Re: jeff_eisenberg]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4285
Loc: New Jersey
Looks like your messages are overwriting on your screen - add
 Code:
$ = SetOption('WrapAtEOL', 'On')
to the beginning of your script to have it display across multiple lines - it might make more sense.

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 ?
does the command look correct? Quotes in the right place? If so, copy the text off the screen and paste it into a .kix file to test - as is - and see what you get.

If that errors as well, try
 Code:
If Exist($Src) 'Got source!' ? EndIf
If Exist($Dst) 'Got destination!' ? EndIf
to see if Kix can actually verify the paths.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#193571 - 2009-04-23 07:17 PM Re: Move Command [Re: Glenn Barnas]
jeff_eisenberg Offline
Fresh Scripter

Registered: 2009-02-26
Posts: 45
Loc: CA
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

Top
#193572 - 2009-04-23 11:29 PM Re: Move Command [Re: jeff_eisenberg]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4285
Loc: New Jersey
I'll try to reproduce it when I get to the lab..

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#193574 - 2009-04-23 11:59 PM Re: Move Command [Re: Glenn Barnas]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11567
Loc: CA
UNC does not support LONG file names even when using quotes. You must use the SHORT name for the path.
Top
#193575 - 2009-04-24 12:43 AM Re: Move Command [Re: NTDOC]
jeff_eisenberg Offline
Fresh Scripter

Registered: 2009-02-26
Posts: 45
Loc: CA
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.

Top
#193577 - 2009-04-24 01:20 AM Re: Move Command [Re: jeff_eisenberg]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4285
Loc: New Jersey
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 ?
Result was success, file was moved. Destination path contained userID value and spaces (My Test).

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
_________________________
Actually I am a Rocket Scientist! \:D

Top
#193591 - 2009-04-24 07:31 PM Re: Move Command [Re: Glenn Barnas]
jeff_eisenberg Offline
Fresh Scripter

Registered: 2009-02-26
Posts: 45
Loc: CA
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.

Top
#193595 - 2009-04-24 11:42 PM Re: Move Command [Re: jeff_eisenberg]
jeff_eisenberg Offline
Fresh Scripter

Registered: 2009-02-26
Posts: 45
Loc: CA
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.

Top
#193596 - 2009-04-25 01:19 AM Re: Move Command [Re: jeff_eisenberg]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4285
Loc: New Jersey
That should be
 Code:
Shell '%ComSpec% /c RD "' + $Src + '"/S /Q'
Here the quotes are used to enclose the $Src content in case it has spaces.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Arend_, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Allen) and 191 anonymous users online.
Newest Members
thequeen, ameliaryan, shalomsalami, dkdssdk, Vroon
17639 Registered Users

Generated in 0.045 seconds in which 0.017 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org