Link to home
Start Free TrialLog in
Avatar of Falk2
Falk2

asked on

Dir Function -> get all *.TXT in a folder and there subfolders

Hi!

is there an easy way to get all *.txt in a folder (e.g. C:\Programs) and then get from this folder all subfolders with have *.txt with the function DIR?

Falk2
Avatar of CJ_S
CJ_S
Flag of Netherlands image

the following command will do that:
dir/s *.txt -> MyTextFile.txt

Regards,
CJ

Uhm, should've also said:
it will write the contents to mytextfile.txt

regards,
CJ
ASKER CERTIFIED SOLUTION
Avatar of GeoffKell
GeoffKell

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of RodStephens
RodStephens

For an example that searches subdirectories for files matching a pattern (*.txt, etc.), look at:

    http://www.vb-helper.com/howto/search.zip

For an example that does the same thing but uses the API instead of VB's Dir function, look at:

    http://www.vb-helper.com/howto/search.zip

This version is faster but more complicated.

For some other interesting examples, go to:

    http://vb.digitalroutes.co.uk/index.shtml?file+search

These examples do things like search subdirectories for files that contain a certain string or search for .doc files that contain a certain string.
Avatar of Falk2

ASKER

thanks

work very fine :)

Falk2