| View previous topic :: View next topic |
| Author |
Message |
FreezingFire Admin Team

Joined: 23 Jun 2002 Posts: 3508
|
Posted: Fri Oct 11, 2002 9:59 pm Post subject: LIST FILELIST |
|
|
OK...I know this question has been asked a million times, and the solution is simple, but even after spending an hour on this I still haven't figured this out.
How can I get a list of all of the files on the computer, but not directories, and including system and hidden files.
LIST FILELIST,1,C:,*SH is what I am using and this will not work. I am trying to make a search/file utility program...
Thanks for any help.  _________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Sat Oct 12, 2002 12:35 am Post subject: |
|
|
Actually the solution isn't all that simple to omit dir
names, unless ya can use the DOS DIR command.
In VDS you'll have to load the complete subdir
list:
LIST FILELIST, 1, C:, *
then loop thru it with LIST FILELIST to get the files
for each dir (don't forget to add "C:" to the subdir
list, or it will miss the root files).
ALSO, when you use filters (such as "SH" in your
example), this limits the file list to those file types.
You can use "ASHR" to get all files except normal
files that don't have the "A" attribute.
To absolutely get all files, use FILELIST twice. First
with no attribute, then using "SHR". If you add them
to a SORTED created list (list 1, etc.), it will remove
duplicates.
I'm not sure why your file search program must
have the dirs omitted. If you're worried about
finding a filename in a dir name, you could use
@file() to see if it's actually a file when it finds a
match...
Cheers, Mac  _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
Serge Professional Member


Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
Posted: Sun Oct 13, 2002 9:33 am Post subject: |
|
|
Have you had a look at the API handbook? There is a command that you can use to add a list of filenames to a list box with many options possible: archive files, all files, all files + sub-directories, and so on...
I have done a copy and paste for you below - hope it helps.
===============================================
LB_DIR
Windows = (Windows NT, Windows 95, Windows 98, Win32's)
wParam = (WPARAM) uAttrs; // file attributes
lParam = (LPARAM) lpszFileSpec; // filename address
Message ID = $018D
Description: An application sends an LB_DIR message to add a list of filenames to a list box.
Parameters
WPARAM UATTRS VALUES
Value of wParam. Specifies the attributes to be used to define what type of files and directories should be added to the list box.
Value
0 = Archive file types
2 = All files
50 = All files with sub-directories
52 = Archive file types with sub-directories
55555 = All drives
5555555 = All drives and files
99999 = All sub-directories and Hidden and Read-only files
9999999 = All sub-directories
*note: Subdirectory names are enclosed in square brackets ([ ]) ; Drives are listed in the form [-x-], where x is the drive letter.*
LPARAM LPSZFILESPEC VALUES
Value of lParam. Specifies the directory you want the file types to be listed from. If you wanted all the file types listed from windows directory you would use @windir()\. If the directory is a long file name you must use the @shortname attribute.
Ex. @shortname(c:\program files). You can also use the *.* attribute to list all file types, or specify a file type to show. Ex. @windir()\*.exe or @windir()\*.*
Return Value: The return value is the zero-based index of the last filename added to the list.
Sample Source Code
title TEST
DIALOG CREATE,TEST,-1,0,213,215
DIALOG ADD,BUTTON,BUTTON1,170,70,,,,DEFAULT
DIALOG ADD,LIST,LIST1,10,12
DIALOG SHOW
:evloop
wait event
goto @event()
:BUTTON1BUTTON
%A = @sendmsg(@win(~LIST1),$018D,5555555,@windir()\*.*)
warn %A
rem Shows all the drives and files from @windir()\ in list1
goto evloop
:CLOSE
exit
See also:
CB_DIR
Copyright 1995 - 2000 S.A.D.E. s.a.r.l. _________________
|
|
| Back to top |
|
 |
cnodnarb Professional Member


Joined: 11 Sep 2002 Posts: 766 Location: Eastman, GA
|
Posted: Sun Oct 13, 2002 1:06 pm Post subject: |
|
|
To get hidden directories (no sub-directories) in c: use
| Code: |
list filelist,list1,c:,DH
|
You will have to check for extensions too though, because for some *stupid* reason this includes large hidden files as well.
NodNarb |
|
| Back to top |
|
 |
FreezingFire Admin Team

Joined: 23 Jun 2002 Posts: 3508
|
Posted: Sun Oct 13, 2002 2:03 pm Post subject: |
|
|
Thanks.  _________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Tue Oct 15, 2002 11:27 am Post subject: |
|
|
If anyone can get any of the above methods (including
the one I suggested) to list as many files as the DOS
DIR /s command, or as many dirs/subdirs as the DOS
DIR /s /a:D command, please let me know how
ya do it.
DOS DIR shows 63 more files than VDS FILELIST does in
my Windows directory. And this is using FILELIST twice
(both with and without the SHR attributes), and NOT using
the hidden attribute in the DIR command. Using H in the
DOS command (DIR /s /a:H) finds another 59 files...
Apparently the command LIST FILELIST, 1, %%start, *
doesn't load all dirs/subdirs...
Here's the VDS code I used (sorry for so many lists, but
I wanted the root files listed first, everything alphabetized,
and duplicates removed by the sorted lists).
| Code: |
OPTION SCALE, 96
OPTION DECIMALSEP, "."
TITLE By Mac
DIALOG CREATE,Test Program,-1,0,500,320
DIALOG ADD,LIST,L1,5,5,490,290
DIALOG ADD,STATUS,Stat,"Please Wait..."
DIALOG SHOW
LIST CREATE, 1, SORTED
LIST CREATE, 2, SORTED
LIST CREATE, 3, SORTED
LIST CREATE, 4, SORTED
rem -- This can be a drive or just a directory --
%%start = @windir()
rem -- Add the root files first --
LIST FILELIST, 1, %%start
LIST FILELIST, 2, %%start, SHR
%x = 0
REPEAT
if @greater(@count(1), %x)
LIST ADD, 3, @item(1, %x)
end
if @greater(@count(2), %x)
LIST ADD, 3, @item(2, %x)
end
%x = @succ(%x)
UNTIL @both(@greater(%x, @count(1)), @greater(%x, @count(2)))
LIST ASSIGN, L1, 3
LIST CLEAR, 1
LIST CLEAR, 2
LIST CLEAR, 3
rem -- Load Dir/SubDir list --
LIST FILELIST, 1, %%start, *
%x = 0
REPEAT
if @greater(@count(1), %x)
LIST FILELIST, 2, @item(1, %x)
LIST FILELIST, 3, @item(1, %x), SHR
end
%y = 0
REPEAT
if @greater(@count(2), %y)
LIST ADD, 4, @item(2, %y)
end
if @greater(@count(3), %y)
LIST ADD, 4, @item(3, %y)
end
%y = @succ(%y)
UNTIL @both(@greater(%y, @count(2)), @greater(%y, @count(3)))
LIST CLEAR, 2
LIST CLEAR, 3
%x = @succ(%x)
UNTIL @greater(%x, @count(1))
%x = 0
REPEAT
if @greater(@count(4), %x)
LIST ADD, L1, @item(4, %x)
end
%x = @succ(%x)
UNTIL @greater(%x, @count(4))
LIST CLEAR, 1
LIST CLEAR, 2
LIST CLEAR, 3
LIST CLEAR, 4
DIALOG SET, Stat, Finished - @count(L1) files found...
:EVLOOP
WAIT EVENT
goto @event()
:CLOSE
EXIT
|
Cheers, Mac _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
vtol Valued Contributor


Joined: 05 Feb 2004 Posts: 656 Location: Eastern Indiana
|
Posted: Fri Oct 26, 2007 7:16 am Post subject: |
|
|
Hi
I know this is old post, but I've allways been wondering why lines like below hardly ever worked for me and my VDS5?
| Code: | | %A = @sendmsg(@win(~LIST1),$018D,5555555,@windir()\*.*) |
From Serge POSTed CODE above...
Thanks |
|
| Back to top |
|
 |
DaveR Valued Contributor


Joined: 03 Sep 2005 Posts: 413 Location: Australia
|
Posted: Fri Oct 26, 2007 9:07 am Post subject: |
|
|
I'm assuming you are referring to the resulting invalid function error? If so, it's because there is no @win() in VDS5 so you need to use @winexists()
| Code: | | %A = @sendmsg(@winexists(~LIST1),$018D,5555555,@windir()\*.*) |
_________________ cheers
Dave |
|
| Back to top |
|
 |
vdsalchemist Admin Team

Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Sun Oct 28, 2007 1:05 am Post subject: |
|
|
The @win() used to be the short version of @winexists() in versions of VDS prior to VDS 5. I am not sure if it existed in VDS 4.x but it did in the 3.x and 2.x versions. I don't know why Jules dropped it from the runtime. I guess people was getting it confused with @windir() or maybe the runtime??? Anyway some of the older help files still have @win() instead of @winexists(). _________________ Home of
Give VDS a new purpose!
 |
|
| Back to top |
|
 |
vtol Valued Contributor


Joined: 05 Feb 2004 Posts: 656 Location: Eastern Indiana
|
Posted: Sun Oct 28, 2007 7:02 am Post subject: |
|
|
wow
So thats all it was, thanks
Thats why I gave up on API long time ago, I had it in my head that SP2 changed API so the older API would not work anymore.
I'll have to remember this API Hell-0-weeny tricky.
Guess thats what I get for starting with vds5  |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|