Page 1 of 2 12>
Topic Options
#26081 - 2002-07-29 09:43 PM Check if folder exists
badboii Offline
Fresh Scripter

Registered: 2002-03-07
Posts: 32
Loc: Seattle, WA
Okay I used the trusty search function and couldn't find how to check if a folder exists. Basically computers on my network are failing and there's one thing they all pretty much have in common. They all have at least a "C:\Found.001" folder which gets created when a system unexpectedly reboots.

What I'm trying to do is to check if those folders exists and based on how many folders there are rate their severity. So if 1 folder exists then okay but if 8 exist then ALARM.

I'm using Kix 4.02
Windows 2000

Thanks for any help!
brian_zamora@hotmail.com
_________________________
========================== Brian Zamora Computer Technician brian_zamora@hotmail.com ==========================

Top
#26082 - 2002-07-29 09:51 PM Re: Check if folder exists
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Did you check the manual. It has an Exist() function that when combined with IF would give you an IF EXIST().
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#26083 - 2002-07-29 10:00 PM Re: Check if folder exists
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Sorry, a little too quick with the RTFM...

What you should be using is the DIR() function. Take a look at my DIR() Primer in the FAQ section. It has pretty well everything you need.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#26084 - 2002-07-29 10:23 PM Re: Check if folder exists
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Are you using FAT with Windows 2000 or NTFS? I've only seen the C:\found.001 folder when using a FAT file system. NTFS is much more robust compared to FAT and the likelyhood of a loss of files in case of a crash is much less.

Of course, there are security reasons, too, to use NTFS.
_________________________
There are two types of vessels, submarines and targets.

Top
#26085 - 2002-07-30 01:14 AM Re: Check if folder exists
badboii Offline
Fresh Scripter

Registered: 2002-03-07
Posts: 32
Loc: Seattle, WA
Thanks guys for the help....yes it appears that only the FAT32 systems are the ones that crash and have that found.001 problem.....unfortunately running NTFS also requires a little more heftier hardware which we do not have (most are 233mhz running Windows 2000)....I'll post my code if anyone ever needs a way to determine which systems may crash in the near future...

code:
; Determine how many Found.* Folders are on a machine
$FolderExists = Dir("C:\FOUND.*")
$found = 0
While $FolderExists <> "" AND @ERROR = 0
$found = $found + 1
$FolderExists = Dir("")
Loop
?"Total No. of Faulty Found folders: " + "$found"

_________________________
========================== Brian Zamora Computer Technician brian_zamora@hotmail.com ==========================

Top
#26086 - 2002-07-30 01:56 AM Re: Check if folder exists
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Badboii,
Are you sure about the reqs? When we rebuilt our FAT32 P233 Wintendos as Win2K with NTFS, we saw an improvement in performance. Disk size waas an issue but that's irregardless of whether it's setup as FAT or NTFS. We did notice however that 256 meg of RAM was a must.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#26087 - 2002-07-30 02:28 AM Re: Check if folder exists
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
I have to agree. I would definitely prefer NTFS over FAT since the performance is slightly better and the filesystem itself is more robust. Additionally, one can actually secure an NTFS installation of Windows 2000.

BTW, my users are pretty happy with a 128MB P3-450 running Windows 2000 Pro. This is my minimum requirement for W2K boxes. I still have some P-90 with 64MB FPM running Windows NT 4.0 [Wink]
_________________________
There are two types of vessels, submarines and targets.

Top
#26088 - 2002-07-30 04:20 AM Re: Check if folder exists
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Yeah well, we're a Lotus Notes shop. That immediately doubles the RAM req. That and my users open every app they 'may' need when the logon and leave them all open until there's a power bump.

You know, if it wasn't for the users, we'd have great jobs. [Wink]
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#26089 - 2002-07-30 10:34 AM Re: Check if folder exists
MightyR1 Offline
MM club member
*****

Registered: 1999-09-09
Posts: 1264
Loc: The Netherlands
Badboii,

try this:

code:
Break on CLS
If Exist("e:\y\nul") <> 0
? "Y exists"
Else
? "Y missing"
EndIf

_________________________
Greetz,
Patrick Rutten

- We'll either find a way or make one...
- Knowledge is power; knowing how to find it is more powerful...
- Problems don't exist; they are challenges...

Top
#26090 - 2002-07-30 10:43 AM Re: Check if folder exists
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
badboy, what if you change that found script to search only folders, not files too?
so something like:
code:
; Determine how many Found.* Folders are on a machine
$FolderExists = Dir("C:\FOUND.*\")
$found = 0
While $FolderExists <> "" AND @ERROR = 0 $found = $found + 1
$FolderExists = Dir("")
Loop
?"Total No. of Faulty Found folders: " + "$found"

_________________________
!

download KiXnet

Top
#26091 - 2002-07-30 04:54 PM Re: Check if folder exists
badboii Offline
Fresh Scripter

Registered: 2002-03-07
Posts: 32
Loc: Seattle, WA
Mighty...I tried that but I kept getting an @ERROR of 0...

Lonkero....Thanks that's actually what I wanted to do, the script I have works if any folder OR file is named folder.001.....I'll try the change today at work

Thanks guys!!!
_________________________
========================== Brian Zamora Computer Technician brian_zamora@hotmail.com ==========================

Top
#26092 - 2002-07-30 05:27 PM Re: Check if folder exists
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Or from the FAQ...

The above example is fine if you're running KiX 4.xx, but for KiX 3.6x, you need to specify $FileName = Dir("C:\TEMP\*.*") instead.

If (GetFileAttr($basedir+"\"+$name) & 16) will filter out files, showing only folders. Add a NOT to it and you filter out folders, showing only files.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#26093 - 2002-07-30 06:36 PM Re: Check if folder exists
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
les, goodie...
gladly he uses 4.02 [Big Grin]

{edit}
and that is like you said up from 3.60
versions before that needs to use exist method...

[ 30 July 2002, 18:40: Message edited by: Lonkero ]
_________________________
!

download KiXnet

Top
#26094 - 2002-07-30 06:42 PM Re: Check if folder exists
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Yes, I can read... [Eek!] badboii stated that in the first post. More for the copy/paste junkies that can't read and are running 3.xx.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#26095 - 2002-07-30 06:55 PM Re: Check if folder exists
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
yeah yeah.
quessed that one.

just playing around cause no so much new posts here.
all americanos still sleeping I quess...

{edit}
btw, said that you can read but didn't tell do you still use 3.xx?
{edit}

[ 30 July 2002, 18:57: Message edited by: Lonkero ]
_________________________
!

download KiXnet

Top
#26096 - 2002-07-30 07:11 PM Re: Check if folder exists
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Perhaps you need to read more or work on your memory. [Wink]

http://81.17.37.55/board/ultimatebb.php?ubb=get_topic;f=2;t=003550;p=2
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#26097 - 2002-07-30 07:22 PM Re: Check if folder exists
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
mm...
you didn't actually say what version you used. [Razz]
_________________________
!

download KiXnet

Top
#26098 - 2002-07-30 08:14 PM Re: Check if folder exists
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
quote:
all americanos still sleeping I quess...
Hey, I'm offended now, I'm already working since 7:30am and it's now 2:20pm. And I definitely do not sleep at work!

[Wink] [Wink] [Wink]
_________________________
There are two types of vessels, submarines and targets.

Top
#26099 - 2002-07-30 09:00 PM Re: Check if folder exists
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
well, what you are doing then?
coding?
there is three main tasks one can propably has at work:
-sleep
-code kix
-post to kix-related bbs

right?
well, I have 2 addition to this:
-drink coffee
-smoke

[Roll Eyes]
_________________________
!

download KiXnet

Top
#26100 - 2002-07-30 09:22 PM Re: Check if folder exists
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Drink coffee: I'm down to four cups in the morning (down from Navy coffee 24/7, that is,, from a couple of years ago)

Smoke: Never have, never will, and no I DID NOT inhale, either [Wink]

Current project: a) Transfer an IIS server with 8 websites from NT4 to NT5 incl. SQL Server transfer, b) get a laptop and a panelPC interact via TCP/IP running custom National Instruments LabView codes written by Swedish students who are back in Sweden and left messy code.
c) wonder when I can go back to KiXtart coding
_________________________
There are two types of vessels, submarines and targets.

Top
Page 1 of 2 12>


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

Who's Online
0 registered and 2220 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.086 seconds in which 0.04 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