mIRC Homepage
Posted By: logy help in listing folders and files - 30/07/04 12:03 AM
who can make a command who is listing the folders and files from a folder without to list the files from subfolders ?

i use this example, and sux
$findir(c:,*,0)
Posted By: Seifer Re: help in listing folders and files - 30/07/04 01:05 AM
If you specify a depth of 1 with $finddir or $findfile, mIRC will not search any subdirectories.

//echo -a $findfile(c:\mirc\,*,0,1)
searches at a depth of 1 folder, only return files in c:\mirc

//echo -a $findfile(c:\mirc\,*,0,2)
searches at a depth of 2 folders, returning any files found in c:\mirc\download, etc.
Posted By: LocutusofBorg Re: help in listing folders and files - 30/07/04 07:02 AM
Actually, those two commands do not list all the files, they merely count how many are found. The fix is simple: you can add a command in the $findfile, and it will perform that command on every file found. Don't be making complex things here tho, if you want to do more than a single command, parse it through an alias, or it will become awful.

Code:
//echo -a $findfile("c:\program files\mirc\",*,0,1,[color:red]echo -s $1-[/color])


The part in red will be performed on every file found, in this case, the full path will be echoed in the status window.
Posted By: MikeChat Re: help in listing folders and files - 03/08/04 06:16 AM
I tried to come up with a start for you

Code:
 
/listfolders .echo -q $findfile($mircdir,*,0,listfiles $nofile($1-)) | readfilelist
/listfiles {
  var %data = $replace($$1-,$chr(32),$chr(160))
  writeini listfiles.ini folders %data %data 
  echo -s $1-
}
/readfilelist {
  var %foldercount = $ini(listfiles.ini,folders,0)
  var %i = 1
  :Loop
  var %getfolder = $replace($ini(listfiles.ini,folders,%i),$chr(160),$chr(32))
  echo -a %getfolder has $findfile(%getfolder,*,0) Files
  inc %i
  if (%i <= %foldercount) { goto Loop }
}
 


you will note that using this will cause mIRC to "lock up" while it runs.
I have it set to just read the mIRC folder and that alone caused my mIRC to stall.
Posted By: Iori Re: help in listing folders and files - 03/08/04 07:28 AM
You can speed it up quite a lot with a couple of simple changes...
Code:
listfolders {
  window -n @filelist | clear @filelist | .fopen -no list files.lst
  echo -e @filelist * $!mircdir has $finddir($mircdir,*,0,.fwrite -n list $1-).shortfn $&
    dirs and $findfile($mircdir,*,0) files
  .fseek list 0
  while $fread(list) {
    echo @filelist $+(5,$longfn($v1),) has12 $findfile($v1,*,0,1) Files
    inc %i
  }
  .fclose list
  window -a @filelist
}

© mIRC Discussion Forums