kncowans
(Getting the hang of it)
2003-03-11 10:02 AM
Converting this line of code to KiXtart

Hello all

Could someone please help.

I am trying to convert the following line of code to use only KiXtart commands as I am trying to get away from using Shell "%ComSpec% commands.

Shell "%ComSpec% /c dir N:\ /a-d /b > $tempfile"

Thanks in advance

Kevin


Schuliebug
(Hey THIS is FUN)
2003-03-11 10:14 AM
Re: Converting this line of code to KiXtart

You could use the KiXtart function Dir(), see the manual for the syntax. For the bare format you could use:
code:
  $File=SubStr($File,37)

To be sure that only files are resturned, use:
code:
  If (GetFileAttr($File) & 16)<>16
; File, no directory..
EndIf

You could also get the Pipe() UDF to get the result of your command in am array and loop that array! Search the BB to find Pipe().


JochenAdministrator
(KiX Supporter)
2003-03-11 10:21 AM
Re: Converting this line of code to KiXtart

Kevin ...

translate this to : list directories in N:\ non-recursively (/b is irrelevant I think)

That'd be then :



break on

global $folders[0]
dim $n

$n = dir("n:\")
do
    if getfileattr("n:\" + $n) & 16 ;folder
        $folders[ubound($folders)] = $n
        redim preserve $folders[ubound($folders)+1]
    endif
    $n = dir()
until $n = ""  or @error

if ubound($folders)
    redim preserve $folders[ubound($folders)-1]
endif

"Folders in N:\" ?
for each $f in $folders
    $f ?
next

get $



kncowans
(Getting the hang of it)
2003-03-11 11:52 AM
Re: Converting this line of code to KiXtart

Hello

Thanks for the replies.

JPols, I am trying to list Non Directories, i.e. only files in N:\ non recursively.

Otherwise your script is exactly what I am looking for.

Thanks

Kevin


LonkeroAdministrator
(KiX Master Guru)
2003-03-12 12:55 AM
Re: Converting this line of code to KiXtart

for me it looks silver plate [Big Grin]

just change the folder attribute (16) or do vice versa check:
if not getfileattr("n:\" + $n) & 16 ;non folder


JochenAdministrator
(KiX Supporter)
2003-03-11 01:33 PM
Re: Converting this line of code to KiXtart

yeah !

Sealeopard
(KiX Master)
2003-03-11 04:22 PM
Re: Converting this line of code to KiXtart

See the DirList() - Returns an array with a list of files in a given directory UDF in the UDF Forum.

kncowans
(Getting the hang of it)
2003-03-11 06:24 PM
Re: Converting this line of code to KiXtart

Hello all

Thanks for all the help.

I do not think that my brain is in gear at the moment as I forgot about the &16 part.

Thanks again

Kevin


Radimus
(KiX Supporter)
2003-03-11 07:09 PM
Re: Converting this line of code to KiXtart

or the UDF EnumDir()