• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 183
  • Last Modified:

search all drives for a file

search all available drives (cd and Usb) except C:\ untill file "Update .zip" is found
Then copy it to the c\: drive.
Jimbo
0
Jimbo1954
Asked:
Jimbo1954
  • 2
  • 2
1 Solution
 
jppintoCommented:
Here you can find code to search for the file:

http://www.experts-exchange.com/Programming/Languages/.NET/Visual_Basic.NET/Q_21679731.html

Then you can just copy it using a command like this:

File.Copy(strPath &"\Update.zip", "C:\Update.zip")

jppinto
0
 
Jimbo1954Author Commented:
Hi Thanks for the reply

Basically what i am trying to do is update a system
the file update.zip will always be in the root usually on a usb pen drive but could also be on cd

the problem is i dont know what disc drives are present on the machines to be updated or if the pen drive has previously be allocated a drive letter (eg X or z)

i dont need to search drive c because the update will always be either usb drive or cd
and it will always be placed in the root of that drive.

once the file is found i want it to be copied to the c:\ drive

hope this explains it better

Jimbo

0
 
CodeCruiserCommented:
Use the My.Computer.FileSystem.Drives collection to get a list of all drives in the system. Then use the

Dim Files as String() = Directory.GetFiles(path, "update.zip", SearchOptions.AllDirectories)

where path will be the driveletter:\
0
 
Jimbo1954Author Commented:
Thanks
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now