Page 1 of 1 1
Topic Options
#49108 - 2000-03-01 05:48 AM Dir() problems
Anonymous
Unregistered


Does anybody have experience with the Dir command? I copied the example out of the manual and it doesn't work.

I am using WinNT 4.0 SP6. I copied the script straight out of the manual and checked it many times. The script is:
$FileName = Dir("C:\TEMP")
While $FileName <> "" and @ERROR = 0
? $FileName
Dir() ; retrieve next file
Loop

I am using the manual that came with Kixtart 3.62 that I downloaded from Steve Wilson's page.
The exact output I am getting is:
DirScript error : unknown command !.
Dir () ;retrieve next file

The first "Dir" is the output from "? $FileName". The "Script error : unknown command !." is in white and the "Dir () ;retrieve next file" is in red.


Thanks,
Bonk

Top
#49109 - 2000-03-01 07:06 AM Re: Dir() problems
Anonymous
Unregistered


Hi Bonk

Try

$FileName = Dir("C:\TEMP")
While $FileName <> "" and @ERROR = 0
? $FileName
Dir()
Loop

Rgds
Don



Top
#49110 - 2000-03-02 05:56 AM Re: Dir() problems
Anonymous
Unregistered


I tried it and it still doesn't work. I did get a different output though. I added a "? @ERROR" before and after the script and this was the output:
0
TEMP
18
The manual says that error 18 is "no more files". There are around 20 files in the directory.
Any ideas?

Thanks,
Bonk

Top
#49111 - 2000-03-02 07:50 AM Re: Dir() problems
Anonymous
Unregistered


Hi Bonk

Great handle!

Sussed it!!
Try

$FileName = Dir("C:\TEMP\*.*")
While $FileName <> "" and @ERROR = 0
? $FileName
Dir()
Loop

Have fun.
Rgds
Don

Top
#49112 - 2000-03-02 10:05 AM Re: Dir() problems
Anonymous
Unregistered


Thanks Don!!
It worked great. This is what I needed it for:
:Norton
$KEY = "HKEY_LOCAL_MACHINE\SOFTWARE\Symantec\SharedDefs"
$RC = readvalue($KEY,"NAV_50_QUAR")
$RegDefDate = substr($RC,instr($RC,".")-4,4)
$FileName = Dir("@ldrive\*i32.exe")
While $FileName <> "" and @ERROR = 0
Dir()
Loop
$VirusDef = substr($FileName,1,4)
if (val($VirusDef) > val($RegDefDate))
SHELL "%COMSPEC% /C @ldrive\$FileName /q"
$MailToggle = 1
$TempString = "Norton has old definition. Date $RegDefDate $CR"
gosub mail
endif
return

The script is still a little rough looking, but it works the way I want. Just a note for people that want to use this to make a list, take out the "? $FileName" and add "? chr(13)". For some reason the "? $FileName" adds a period to the front of the file.

Thanks again,
Bonk

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 811 anonymous users online.
Newest Members
batdk82, StuTheCoder, M_Moore, BeeEm, min_seow
17885 Registered Users

Generated in 0.05 seconds in which 0.023 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