Page 1 of 1 1
Topic Options
#198026 - 2010-03-10 08:10 PM Directory copy does not work properly
SomeITGuy Offline
Just in Town

Registered: 2010-03-10
Posts: 1
Loc: San Diego, CA
My script is supposed to check to see if a local directory exists & if it DOES NOT exist I want to copy a couple of folders from a network share (that has full access to everyone on share & file/folder levels) to the local directory. This seems to copy the folder over even though the local directory exists. I am not getting an error message.

Attaching code as file PACS.kix and pasting below:

 Code:
$path = DIR("C:\Documents and Settings\ctxtest3\Application Data\Amicas\config")

IF EXIST $path
	USE P: "\\varda\Citrixscripts"
	QUIT 9

ELSE
	USE R: "\\varda\i386"
	COPY "\\varda\citrixscripts\PACs\Amicas\" "C:\Documents and Settings\%USERNAME%\Application Data\Amicas\" /s /h
	COPY "\\varda\citrixscripts\PACs\Sun\" "C:\Documents and Settings\%USERNAME%\Application Data\Sun\" /s /h
	USE R: /DEL
ENDIF


Edited by Allen (2010-03-10 09:37 PM)
Edit Reason: added code tags

Top
#198028 - 2010-03-10 09:39 PM Re: Directory copy does not work properly [Re: SomeITGuy]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4562
Loc: USA
I *think* you are using DIR wrong.

Try replacing this
$path = DIR("C:\Documents and Settings\ctxtest3\Application Data\Amicas\config")

with
$path = "C:\Documents and Settings\ctxtest3\Application Data\Amicas\config"

Top
#198029 - 2010-03-10 09:53 PM Re: Directory copy does not work properly [Re: Allen]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4562
Loc: USA
Also, %userprofile% is safer than %username%, because there are times when directory is not exactly the username, ie username.domain.

"%USERPROFILE%\Application Data\Amicas\"

Top
Page 1 of 1 1


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

Who's Online
0 registered and 837 anonymous users online.
Newest Members
M_Moore, BeeEm, min_seow, Audio, Hoschi
17883 Registered Users

Generated in 0.054 seconds in which 0.026 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