Page 1 of 1 1
Topic Options
#34585 - 2002-12-20 03:31 AM Recursive Directory and Attribute Listing Dumped to Text File
Tyson Flint Offline
Fresh Scripter

Registered: 2002-09-25
Posts: 16
Loc: Edmonds, WA
I'm trying to write a script (under Win2k) that will write the attribute number of every file on a drive to one single text file. After the script runs awhile, it displays:

"Script Error: failed to find/open script"

The "FOR" command is also causing a problem. It only wants to go one level deep.

Does anyone know how to get kixtart to walk the directory tree (similar to a DIR /S) and perform a command for each directory?

I'm also concerned that writing a script that calls itself will hang after going a few levels deep.

I've been tring to launch the script with:

M:\> for /d %x in (*.*) do kix32 c:\fattrib.kix ".\%x"

Contents of fattrib.kix are as follows:

BREAK ON
$Dir = "%1"
$File = Dir( $Dir + "\*.*" )
WHILE @ERROR = 0 AND $File
$attribute = GetFileAttr($Dir + "\" + $File)
IF REDIRECTOUTPUT("c:\attributes.txt",0)=0
? $attribute
chr(59)
$Dir + "\" + $File
ENDIF
IF @ERROR = 0
; try for next subkey
$File = Dir("")
ENDIF
LOOP
EXIT 0

Top
#34586 - 2002-12-20 03:41 AM Re: Recursive Directory and Attribute Listing Dumped to Text File
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
you might want to check some of the dir udfs.
like dirscan: http://www.kixtart.org/board/ultimatebb.php?ubb=get_topic;f=12;t=000303

with dirscan you would do:
code:
$basedir="c:\"
$nul=REDIRECTOUTPUT("c:\attributes.txt",0)

for each $file in DirScan($basedir,0,1)
? getfileattr($file)
chr(59)
next

so, this way you don't need to re-invent the wheel [Wink]
_________________________
!

download KiXnet

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 837 anonymous users online.
Newest Members
ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder, M_Moore
17887 Registered Users

Generated in 0.054 seconds in which 0.028 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