mIRC Home    About    Download    Register    News    Help

Print Thread
#112852 26/02/05 07:41 PM
Joined: Jun 2004
Posts: 291
W
Fjord artisan
OP Offline
Fjord artisan
W
Joined: Jun 2004
Posts: 291
hey, how can i list all the files in a directory
but without listing other files and dirs in the sub dirs.

i was using

$findfile($1-,*,0,msg =$nick $1- $bytes($file($1-).size,bkmgt3).suf)

i thought it would only list the files in that dir not every dir >_<
i tried it in c:\ lol then i found out..
any one have any ideas?

also how can i get the size of a directory.

^^
thanks

#112853 26/02/05 08:42 PM
Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
  1. Set the depth parameter of $findfile to 1:

    $findfile($1-,*,0,[color:blue]1,msg =$nick $1- $bytes($file($1-).size,bkmgt3).suf)[/color]
  2. Try this alias:

    Code:
    ; Usage: $DirSize(directory)
    ;
    ; Returns the directory's size in bytes.
    
    alias DirSize {
      if !$isdir($1) { return }
      .comopen oFSO Scripting.FileSystemObject
      !.echo -q $com(oFSO, GetFolder, 1, bstr, $1, dispatch* oFolder)
      !.echo -q $com(oFolder, Size, 2)
      var %size = $com(oFolder).result
      .comclose oFolder
      .comclose oFSO
      return %size
    }

#112854 26/02/05 10:35 PM
Joined: Jun 2004
Posts: 291
W
Fjord artisan
OP Offline
Fjord artisan
W
Joined: Jun 2004
Posts: 291
works great
thanks alot ^_^


Link Copied to Clipboard