Page 1 of 1 1
Topic Options
#58071 - 2001-08-08 10:13 AM Howto: Difference between file and folder
Ashpoint Offline
Starting to like KiXtart

Registered: 1999-08-27
Posts: 192
Loc: Sydney, NSW, Australia
How do I tell the difference between a file and a folder?

Problem: The (recent) SirCam virus is characterised by the presence of a file called Sirc32.exe in the C:\Recycled folder (Win9x computers). The McAfee "fix" (among others) is to create a Folder called Sirc32.exe in the C:\Recycled folder.

In mt KixTart.Kix file I have code that tests for the existance of C:\Recycled\Sirc2.exe and if it's there, I trigger a report to alert me that the workstation has been infected.

Code:
IF EXIST("C:\Recycled\Sirc32.exe")
$SirCam = "Y"
ENDIF


The code interprets the folder as a file.

What do I need to change to test "Y" for the file and "N" for the folder?

Top
#58072 - 2001-08-08 10:26 AM Re: Howto: Difference between file and folder
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Ash:

folder :

code:

IF EXIST("C:\Recycled\Sirc32.exe\")
"it's a folder" ?
endif

file:

code:

IF EXIST("C:\Recycled\Sirc32.exe")
"it's a file" ?
endif

right ?

Jochen

_________________________



Top
#58073 - 2001-08-08 10:30 AM Re: Howto: Difference between file and folder
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
Jpols is right like usual.

J, have you started migration to kix2k1 yet?
I was bold and did it! no errors yet...
and I didn't have to change my old code at all!!!
I quess, I do so pure kix-friendly code that no errors occure.

_________________________
!

download KiXnet

Top
#58074 - 2001-08-08 01:01 PM Re: Howto: Difference between file and folder
Ashpoint Offline
Starting to like KiXtart

Registered: 1999-08-27
Posts: 192
Loc: Sydney, NSW, Australia
Hmmm... Thanks for the responses. Only thing is that MY code has been reporting the folder as a file.

Maybe I have to test for the folder first, then test for the file.

Something like...

code:

$SirCam = "N"
IF EXIST("C:\Recycled\Sirc32.exe\")
$SirCam = "N"
ELSE
IF EXIST("C:\Recycled\Sirc32.exe")
$SirCam = "Y"
ENDIF
ENDIF

I'll try this and see how it goes.

Thanks

Top
#58075 - 2001-08-08 01:16 PM Re: Howto: Difference between file and folder
Ashpoint Offline
Starting to like KiXtart

Registered: 1999-08-27
Posts: 192
Loc: Sydney, NSW, Australia
I revised the code and will try the following next time I have access to the client's server...

code:

IF EXIST("C:\Recycled\SirC32.exe\") = 0
IF EXIST("C:\Recycled\SirC32.exe") = 1
$SirCam = "Y"
ENDIF
ENDIF

Please comment.

Top
#58076 - 2001-08-08 01:58 PM Re: Howto: Difference between file and folder
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
that depends !

what are the actions you want to automate in which case (why not code the check for folder/file seperated)


Jochen

_________________________



Top
#58077 - 2001-10-12 04:08 AM Re: Howto: Difference between file and folder
MCA Offline
KiX Supporter
*****

Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
Dear,

Another solution is by checking file attribute status.
Code can be:

code:

IF (GetFileAttr("c:\Recycled\SirC32.exe") & 16)
$file_type="d" ; irectory
ELSE
$file_type="f" ; ile
ENDIF


Greetings.
_________________________
email scripting@wanadoo.nl homepage scripting@wanadoo.nl | Links | Summary of Site Site KiXforms FAQ kixtart.org library collection mirror MCA | FAQ & UDF help file UDF kixtart.org library collection mirror MCA | mirror USA | mirror europe UDF scriptlogic library collection UDFs | mirror MCA

Top
#58078 - 2001-10-12 04:11 PM Re: Howto: Difference between file and folder
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
MCA !!!

how was the holiday ?
Nice to see you back !

Jochen

_________________________



Top
#58079 - 2001-10-12 04:48 PM Re: Howto: Difference between file and folder
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
yeah. allmost kinda weird...
_________________________
!

download KiXnet

Top
#58080 - 2001-10-12 05:07 PM Re: Howto: Difference between file and folder
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Lonkero !

how was the holiday ?
Nice to see you back !

Jochen

_________________________



Top
#58081 - 2001-10-13 03:33 AM Re: Howto: Difference between file and folder
MCA Offline
KiX Supporter
*****

Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
Hi focks,

The same.

For all the possible questions about: how was your vacation?
Some info:

  • a lot of sun and beautiful pictures. Pictures which can have the french name
    'carte postale'.
  • we had meet a lot of new and old friends.
  • great bike ride in the mountains of French Pyrenean. Some interesting trips are
    'col du Tourmalet'and 'Pic du Canigou'.
    JPols possible you knows what people think about a bike-trip on the mountain
    "Mont Ventoux".
    The "Pic du Canigou" doesn't have a normal road. During the climb of the
    mountain the road goes up with also pieces of 21%. Going downhill is only
    possible with about 5 or 7.5 miles per hour. Even when it goes with about
    10%-15% downhill.
    After completion it was only about 3000 miles with 90 mountain passes.
  • also we had read some interesting books.

Possible your are missing our reaction on topic:
http://kixtart.org/cgi-bin/ultimatebb.cgi?ubb=get_topic&f=1&t=002637
At the moment we try to read about 750 new topics.

Greetings.

_________________________
email scripting@wanadoo.nl homepage scripting@wanadoo.nl | Links | Summary of Site Site KiXforms FAQ kixtart.org library collection mirror MCA | FAQ & UDF help file UDF kixtart.org library collection mirror MCA | mirror USA | mirror europe UDF scriptlogic library collection UDFs | mirror MCA

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 869 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.278 seconds in which 0.234 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