Jimbo1954
asked on
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
Then copy it to the c\: drive.
Jimbo
ASKER
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
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
Use the My.Computer.FileSystem.Dri ves collection to get a list of all drives in the system. Then use the
Dim Files as String() = Directory.GetFiles(path, "update.zip", SearchOptions.AllDirectori es)
where path will be the driveletter:\
Dim Files as String() = Directory.GetFiles(path, "update.zip", SearchOptions.AllDirectori
where path will be the driveletter:\
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks
https://www.experts-exchange.com/questions/21679731/Searching-for-files-across-all-drives.html
Then you can just copy it using a command like this:
File.Copy(strPath &"\Update.zip", "C:\Update.zip")
jppinto