View previous topic :: View next topic |
Author |
Message |
ColdWind Newbie
Joined: 18 Apr 2001 Posts: 12 Location: UK
|
Posted: Mon Jan 14, 2002 4:00 pm Post subject: List filtering... |
|
|
Hi, i have a list that displays all the files in a directory, but how can i make it is that if the extention is not say *.txt dont add to list?
Thank you... _________________ My site @ http://ix.d2g.com |
|
Back to top |
|
|
vdsalchemist Admin Team
Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Mon Jan 14, 2002 4:03 pm Post subject: |
|
|
ColdWind,
You could load the list with all the files then search through the list and remove all files that have the *.txt extensions from the list. _________________ Home of
Give VDS a new purpose!
|
|
Back to top |
|
|
vdsalchemist Admin Team
Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Mon Jan 14, 2002 4:10 pm Post subject: |
|
|
ColdWind,
You can also use wildcards with LIST FILELIST in the filespecs section. Here is the info from the VDS help file of VDS 3.x....
FILELIST is used to add to the list <list> the names of files that match a particular specification, which may include wildcards. Note that whether just the name and extension or the full path is returned depends on whether a full path is given in <filespec>. The file specification may optionally be followed by a list of attributes which will be used to filter the list of files selected. The attributes may be specified as: A - archive; D - directory; H - hidden; R - read only; S - system; V - volume label. The attributes are additive, so if you specify HS for example the list will contain files that have the hidden attribute, the system attribute or both.. _________________ Home of
Give VDS a new purpose!
|
|
Back to top |
|
|
ColdWind Newbie
Joined: 18 Apr 2001 Posts: 12 Location: UK
|
Posted: Mon Jan 14, 2002 4:10 pm Post subject: |
|
|
Im only a begginer still finding my way around the program.
How would i search a list?
Thank you. _________________ My site @ http://ix.d2g.com |
|
Back to top |
|
|
Dr. Dread Professional Member
Joined: 03 Aug 2001 Posts: 1065 Location: Copenhagen, Denmark
|
Posted: Mon Jan 14, 2002 4:15 pm Post subject: |
|
|
Hi, Coldwind!
You could do something like this:
Code: | list create,1
list filelist,1,*.*
repeat
if @match(1,".txt")
list delete,1
end
until @not(@match(1,".txt"))
list close,1 |
That will create a list of files in a directory and delete those lines in the list containing .txt
Greetz
Dr. Dread |
|
Back to top |
|
|
ColdWind Newbie
Joined: 18 Apr 2001 Posts: 12 Location: UK
|
Posted: Mon Jan 14, 2002 4:34 pm Post subject: |
|
|
How could i make it so the list removes all file apart from *.txt files?
Thank you... _________________ My site @ http://ix.d2g.com |
|
Back to top |
|
|
vdsalchemist Admin Team
Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Mon Jan 14, 2002 4:46 pm Post subject: |
|
|
Hi ColdWind,
Ok just so I can understand you correctly. Are you saying that you want a filelist with nothing but *.txt files listed or are you saying you want a filelist that excludes *.txt files? _________________ Home of
Give VDS a new purpose!
|
|
Back to top |
|
|
ColdWind Newbie
Joined: 18 Apr 2001 Posts: 12 Location: UK
|
Posted: Mon Jan 14, 2002 5:28 pm Post subject: |
|
|
yes thats right i need a filelist with only the txt file in it no matter what files are in the dir... _________________ My site @ http://ix.d2g.com |
|
Back to top |
|
|
vdsalchemist Admin Team
Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Mon Jan 14, 2002 5:35 pm Post subject: |
|
|
Hi ColdWind,
Ok for that then just do this with the List Filelist command...
LIST FILELIST,1,c:\SOMEDIR\*.TXT
This should put only the *.txt files in the file list. _________________ Home of
Give VDS a new purpose!
|
|
Back to top |
|
|
ColdWind Newbie
Joined: 18 Apr 2001 Posts: 12 Location: UK
|
Posted: Mon Jan 14, 2002 5:40 pm Post subject: |
|
|
Thank you much it works perfectly...
Thank you... _________________ My site @ http://ix.d2g.com |
|
Back to top |
|
|
|