Page 1 of 1 1
Topic Options
#109813 - 2003-12-08 04:18 PM Filename vs Directory Name
dwysocki Offline
Fresh Scripter

Registered: 2001-06-15
Posts: 11
Loc: elgin,tx,us
I was wondering (This may sound stupid) if there is a way to write a script to see if a directory named c:\scripts exist and if not create a directory named scripts in the c: drive. But first to see if there is a file name called scripts with no ext. in the same location and delete it, then create the directory name.

Thanks
David Wysocki
david@elginisd.net

Top
#109814 - 2003-12-08 04:23 PM Re: Filename vs Directory Name
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Yes it is possible to determine within KiX is it is a file or a folder. There are several FAQs written, but the one on DIR() covers the topic for sure.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#109815 - 2003-12-08 04:29 PM Re: Filename vs Directory Name
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
See also EXIST() and GETFILEATTR() in the KiXtart Manual.
_________________________
There are two types of vessels, submarines and targets.

Top
#109816 - 2003-12-08 09:35 PM Re: Filename vs Directory Name
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Hi, I got an extra silver platter and felt generous so here it is Have fun with it.

Code:

$type = GetFileAttr ("c:\scripts")
$exists= Exist ("c:\scripts")
;
Select
Case $exists = "1"
?"Found something called scripts."
Select
Case $type <> "16"
Del "c:\scripts"
?"Type is file, deleted file."
MD "c:\scripts"
?"Created scripts directory."
;
Case $type = "16"
?"Type is directory, doing nothing."
EndSelect
;
Case $exists <> "1"
?"Found nothing called scripts"
MD "c:\scripts"
?"Created directory called scripts."
EndSelect



Edited by R2D2 (2003-12-08 11:34 PM)
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

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 1707 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.218 seconds in which 0.203 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