Solved

DIR /S for Visual Basic?

Posted on 1998-08-17
1
206 Views
Last Modified: 2013-11-25
I have a function that I wish to perform on every file on my hard drive.  I have the function working but for only one file selection at a time.
More detail...I would like to scan all the files on any hard drive I select and  evaluate each filename and path and if filename is of a certain extension, concatenate certain characters of the filename and path into a string which I would like to send to a ascii database file.  Therefore, if 325 files meet the criteria, the database would have 325 strings separated by a space with the concatenated string segments ie
   34123456   c:\r34\123456.drw
   51213141   d:\hello\f51\213141.drw
   82135455   f:\stuff\goodstuf\x82\135455.drw
0
Comment
Question by:JACKO
1 Comment
 
LVL 12

Accepted Solution

by:
mark2150 earned 50 total points
Comment Utility
Good old DOS SHELL command:

ext = ".XXX"     ' Set to desired extension
SHELL( "C:\COMMAND.COM DIR C:\*." & ext & " /s /b /-p > ASCII.TXT", 1)

When this command completes you'll have a vanilla ASCII file, ASCII.TXT with the file names and paths.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now