Page 1 of 1 1
Topic Options
#43261 - 2003-07-23 10:17 PM copying directories from unc path to unc path
keys Offline
Fresh Scripter

Registered: 2003-07-22
Posts: 13
On the file and print machine I have created a directory called migration. The directory migration is shared with full share rights for everyone. Its NTFS rights are for Authenticated Users everything but full control. Each user has a directory in the Migration folder named after their userid. In each users directory are things they want saved. My Documents, favorites, and archived mail in archmail. When the user logs in the script is run. It completes the first copy command with a error code of 0, but nothing is copied to the users My Documents directory in their roaming profile. It stops there and does not complete and does not error out. Any help? Thanks in advance

; \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
; This script copies all of the My Documents, Favorites and ArchMail directories of each user down to their
; redirected directory, profile directory and h: or arcmail directory. v0.1
; \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

$totalmoved = 0 ; used to count how many directoies are moved
; Copies the users my documents. If else is error checking.
Copy "\\fileandprint\Migration\" + @USERID + "\My Documents\" "\\fileandprint\Redirected$\" + @USERID + "\My Documents\" /s
IF @error = 0
? @fullname + "'s My Documents folder was copied to \\fileandprint\Redirected$\" + @USERID + "\"
$totalmoved = $totalmoved + 1
ELSE
? "Could not copy" + @fullname + "'s My Documents folder to \\fileandprint\Redirected$\" + @USERID + "\"
? "System Error Code [" + @error + "]"
? "Press any key to continue."
GET $key

; Copies the users favorites. If else is error checking.
Copy "\\fileandprint\Migration\" + @USERID + "\Favorites\" "\\fileandprint\profiles$\" + @USERID + "\Favorites\" /s
IF @error = 0
? @fullname + "'s Favorites were copied to \\fileandprint\profiles$\" + @USERID + "\Favorites"
$totalmoved = $totalmoved + 1
ELSE
? "Could not copy" + @fullname + "'s Favorites to \\fileandprint\profiles$\" + @USERID + "\Favorites"
? "System Error Code [" + @error + "]"
? "Press any key to continue."
GET $key

; Copies the users archived mail. If else is error checking.
Copy "\\fileandprint\Migration\" + @USERID + "\ArchMail\" "\\fileandprint\Arcmail$\" + @USERID + "\" /s
IF @error = 0
? @fullname + "'s archived mail was copied to \\fileandprint\Arcmail$\" + @USERID + "\"
$totalmoved = $totalmoved + 1
ELSE
? "Could not copy" + @fullname + "'s archived mail to \\fileandprint\Arcmail$\" + @USERID + "\"
? "System Error Code [" + @error + "]"
? "Press any key to continue."
GET $key

; If total moved equals the number of folders moved then the direcory under migration will be
; renamed to @useridMOVED
IF $totalmoved = 3
? "Completely migrated " + @FULLNAME + "."
MOVE "\\fileandprint\Migration\" + @USERID + "\" "\\fileandprint\Migration\" + @USERID + "MOVED\"
ELSE
? "There were errors when moving " + @FULLNAME + ". Only copied " + $totalmoved + " directories."
? "Press any key to continue."
GET $key

Top
#43262 - 2003-07-23 10:22 PM Re: copying directories from unc path to unc path
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
What version of KiXtart are you running?

Please read the Kixtart Manual for correct IF-ELSE-ENDIF syntax as all your ENDIFs are missing.

By default, '$' characters in strings need to be doubled up, this is documented i nthe KIXtart Manual, page 25.
_________________________
There are two types of vessels, submarines and targets.

Top
#43263 - 2003-07-23 10:38 PM Re: copying directories from unc path to unc path
keys Offline
Fresh Scripter

Registered: 2003-07-22
Posts: 13
Stupid me. Thanks for looking that over. When I tested it it didn't complain about the missing ENDIF. I guess i didn't get that far when running.
I read the manual about the strings. I have a question.
$variable = 2
Is
1) ? "Print out this variable: " + $variable
output: "Print out this variable: 2
the same as
2) ? "Print out this variable: $$variable"
output?: "Print out this variable: $variable."
Am i correct on this.
Thanks again

Top
#43264 - 2003-07-23 10:41 PM Re: copying directories from unc path to unc path
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Kind-of. However, you should never use variables inside strings. Better syntax is
code:
? "Print out this variable: " + $variable

together with a
code:
$iRC=setoption('explicit','on')
$iRC=setoption('novarsinstrings','on')

for clean KiXtart scripts.

[ 23. July 2003, 22:49: Message edited by: sealeopard ]
_________________________
There are two types of vessels, submarines and targets.

Top
#43265 - 2003-07-24 09:58 PM Re: copying directories from unc path to unc path
keys Offline
Fresh Scripter

Registered: 2003-07-22
Posts: 13
Thanks for the help. I got it working. It was just some simple coding errors on my part.
I was calling
$variable = unc path
$variable2 = another unc path
COPY "$varaible" "$variable2" /s
when I should have been calling it like:
COPY $variable $variable2 /s
Just like you said with the strings.

Top
#43266 - 2003-07-25 03:55 PM Re: copying directories from unc path to unc path
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
setoption('explicit','on') would have detected the misspelled variable name. [Wink]
_________________________
There are two types of vessels, submarines and targets.

Top
#43267 - 2003-07-25 03:58 PM Re: copying directories from unc path to unc path
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Not sure how to take the wink...

I think the issue was the quotes and that the typo was limited just to the post.

You still make a very good point though.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
Page 1 of 1 1


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

Who's Online
0 registered and 837 anonymous users online.
Newest Members
ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder, M_Moore
17887 Registered Users

Generated in 0.055 seconds in which 0.025 seconds were spent on a total of 12 queries. Zlib compression enabled.

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