Did some testing and here is what I was able to throw together..

bxn, you are correct about error 183.

This hopefully addresses point one.

We'll just focus on the file/folder existence thingy.

First way - using fso:

code:
 ; - Test environment: Windows XP
; - Kix Version: 4.12
; - Kent Dyer
; - 30-October-2002
; - version .8
; - Test: Create a simple text file called ScripTest and insert some text in it
; - 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 fso per Les
BREAK ON
CLS
;Trying To Create A Folder as Necessary
$foldernametocheck = "C:\ScriptTest"
$lenfolder = Len($foldernametocheck)
$foldername = substr($foldernametocheck,4,$lenfolder)

; - First check to see if this is a file
IF EXIST($foldernametocheck) AND NOT (GETFILEATTR($foldernametocheck) & 16)
? $foldernametocheck + " appears to exist as a file"
?'Press Y and <ENTER> to continue and rename the file and create the folder'
?'Press N and <ENTER> to exit'
?'>'
GETS $k
IF $k = 'Y'
SHELL "%comspec% /c ren " + $foldernametocheck + " " + $foldername + "1"
ReportFolderStatus($foldernametocheck)
ELSE
RETURN
ENDIF
ELSE
?$foldernametocheck + " Appears to exist as a folder."
SLEEP 2
ENDIF

FUNCTION ReportFolderStatus($fldr)
; - http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/jsmthFolderExists.asp
DIM $fso, $msg
$fso = CreateObject("Scripting.FileSystemObject")
IF ($fso.folderexists($fldr))
?$fldr + " exists."
ELSE
?$fldr + " doesn't exist."
?"Creating now"
MD $foldernametocheck
IF @error <> 0
?@error
SLEEP 2
ENDIF
ENDIF
ENDFUNCTION
? "File/folder checks complete"
? "Press any Key to exit"
GET $l

Second way - using Kixtart:
code:
 ; - Test environment: Windows XP
; - Kix Version: 4.12
; - Kent Dyer
; - 30-October-2002
; - version .8
; - Test: Create a simple text file called ScripTest and insert some text in it
; - 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 as Necessary
$foldernametocheck = "C:\ScriptTest"
$lenfolder = Len($foldernametocheck)
$foldername = substr($foldernametocheck,4,$lenfolder)

; - First check to see if this is a file
IF EXIST($foldernametocheck) AND NOT (GETFILEATTR($foldernametocheck) & 16)
? $foldernametocheck + " appears to exist as a file"
?'Press Y and <ENTER> to continue and rename the file and create the folder'
?'Press N and <ENTER> to exit'
?'>'
GETS $k
IF $k = 'Y'
SHELL "%comspec% /c ren " + $foldernametocheck + " " + $foldername + "1"
?"Creating "+ $foldernametocheck + " now"
MD $foldernametocheck
IF @error <> 0
?@error
SLEEP 2
ENDIF
ELSE
RETURN
ENDIF
ENDIF
IF EXIST($foldernametocheck) AND (GETFILEATTR($foldernametocheck) & 16)
?$foldernametocheck + " Appears to exist as a folder."
SLEEP 2
RETURN
ELSE
?"Creating " + $foldernametocheck + " now"
MD $foldernametocheck
IF @error <> 0
?@error
SLEEP 2
ENDIF
ENDIF
? "File/folder checks complete"
? "Press any Key to exit"
GET $l

Thank bxn for pointing the error condition out..

Thanks Les for pointing out the option for fso.

Now, to look at the Program existence thing. [Smile]

Cheers,

Kent

[ 03. November 2002, 18:00: Message edited by: kdyer ]
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's