Page 1 of 1 1
Topic Options
#73964 - 2003-03-11 10:02 AM Converting this line of code to KiXtart
kncowans Offline
Getting the hang of it

Registered: 2000-11-11
Posts: 98
Loc: Doncaster, UK
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
_________________________
Kevin Cowans Senior ICT Technician The Armthorpe School

Top
#73965 - 2003-03-11 10:14 AM Re: Converting this line of code to KiXtart
Schuliebug Offline
Hey THIS is FUN
*****

Registered: 2002-01-18
Posts: 379
Loc: Netherlands
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().
_________________________
Kind regards,

Top
#73966 - 2003-03-11 10:21 AM Re: Converting this line of code to KiXtart
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
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 $

_________________________



Top
#73967 - 2003-03-11 11:52 AM Re: Converting this line of code to KiXtart
kncowans Offline
Getting the hang of it

Registered: 2000-11-11
Posts: 98
Loc: Doncaster, UK
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
_________________________
Kevin Cowans Senior ICT Technician The Armthorpe School

Top
#73968 - 2003-03-12 12:55 AM Re: Converting this line of code to KiXtart
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
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
_________________________
!

download KiXnet

Top
#73969 - 2003-03-11 01:33 PM Re: Converting this line of code to KiXtart
Jochen Administrator Offline
KiX Supporter
*****

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



Top
#73970 - 2003-03-11 04:22 PM Re: Converting this line of code to KiXtart
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
See the DirList() - Returns an array with a list of files in a given directory UDF in the UDF Forum.
_________________________
There are two types of vessels, submarines and targets.

Top
#73971 - 2003-03-11 06:24 PM Re: Converting this line of code to KiXtart
kncowans Offline
Getting the hang of it

Registered: 2000-11-11
Posts: 98
Loc: Doncaster, UK
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
_________________________
Kevin Cowans Senior ICT Technician The Armthorpe School

Top
#73972 - 2003-03-11 07:09 PM Re: Converting this line of code to KiXtart
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
or the UDF EnumDir()
_________________________
How to ask questions the smart way <-----------> Before you ask

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 507 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.057 seconds in which 0.024 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