Solved

DIR /S for Visual Basic?

Posted on 1998-08-17
1
207 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
ID: 1429476
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VBA error replacing data 6 37
Adding to a VBA? 6 61
How to produce a SHA-1 hash function in vb6 in order to save it to a table 8 36
Added a column screws up code 5 49
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 …
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

911 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

20 Experts available now in Live!

Get 1:1 Help Now