INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Using CMD to search through network drive

Using CMD to search through network drive

(OP)
I'm writing to see if anyone can tell me the fastest way of extracting filenames from a network drive I have offsite. I have some search criteria provided by users with the help of a userform in Access.

I've tried using FSO which in my experience in this situation is the slowest. I've also tried using CMD with WScript.Shell, which is faster, but I've recorded that it take approximately 7 minutes to perform the check with the macro. Using the Windows search bar in an explorer window provides results in about a minute or less. The parent folders I am searching through have approximately 35,000 folders each containing about 1 to 2 files.

Here is the command I use with CMD with WScript.Shell :

CODE --> vb

strTemp = CreateObject("WScript.Shell").Exec("CMD /C DIR """ & "N:\" & _
                  Me.txtRegion.Value & "\" & Me.txtYear.Value & "\" & _
                  Me.txtDossier.Value & "*.*"" /S /B /A:-D").StdOut.ReadAll 

The results are then split into an array and processed.

Does anyone have any suggestions for how to improve this code?

RE: Using CMD to search through network drive

(OP)
Looks very promising! Thanks for sharing.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close