Folder/Program check..

This hopefully addresses point two and three.

Here is the corrected version:

code:
 ; - Test environment: Windows XP
; - Kix Version: 4.12
; - Kent Dyer
; - 30-October-2002
; - version .8
; - Test: Create a Folder in a sub-directory with the name of Program.exe
; - Findings: a file name and folder name of the same name cannot exist on the same volume
; - Thanks: to bxn from http://kixtart.org for pointing out the error 183 when a file exists with
; - same name as the folder
;
; - using Kixtart commands
BREAK ON
CLS
;Trying To Create A Folder and copy a file as Necessary
$folder = "C:\ScriptTest"
$program = "Program.exe"

IF (GETFILEATTR($folder) & 16) ; - Check to not only see if the file exists, but the folder too
IF EXIST($folder + "\" + $program)
IF EXIST($folder + "\" + $program) AND (GETFILEATTR($folder + "\" + $program) & 16)
?$folder + "\" + $program + " appears to be a folder - please correct"
SLEEP 2
RETURN
ELSE
?$folder + "\" + $program + " appears to be correct"
ENDIF
ELSE
COPY @lserver+"Programs\"+ $program $folder
IF @error <> '0'
?@error
ENDIF
ENDIF
ELSE
?'Press Y and <ENTER> to continue and create the folder and copy the file'
?'Press N and <ENTER> to exit'
?'>'
GETS $k
IF $k = 'Y'
MD $folder
IF @error <> '0'
?@error + ' Error while creating the directory'
ENDIF
COPY @lserver+"Programs\"+ $program $folder
IF @error <> '0'
?@error
ENDIF
ELSE
RETURN
ENDIF
ENDIF
? "File/folder checks complete"
? "Press any Key to exit"
GET $l

Thanks again,

Kent

[ 31. October 2002, 09:06: Message edited by: kdyer ]
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's