Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

DIR /S for Visual Basic?

Posted on 1998-08-17
1
Medium Priority
?
217 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 12

Accepted Solution

by:
mark2150 earned 100 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Suggested Courses

715 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