1.

Solve : Programing help?

Answer»

I do not know if this is possible in programing bu i shall ask.

Lets say my pc is running windows xp pro and for some reason i cannot read the names of the DRIVE letters and i want to search my pc for all word documents and have them copied to my usb memory stick how could i do this without knowing the drive letter.

I just want to be able to run a program and it do the above for me.

the details of my memory stick is : 230mb and i call the drive kelly

is there any way of making a program that will search and copy word documents on to it.

I am running xp sp2you could do a search for *.doc that will bring up all word docs on the computer.true but i would need to copy all the*do files without user interaction to the usb device EITHER that or have them emailed or sent by ftp or renamed to jpeg files and burn them to disk.

basically i am trying to get documents out of my system by any means possible using programing without me having to do anything the programing doing all the work.

This can include printing of text documents instead of copying them to the destination drive.here's a vbscript. save as myscript.vbs, then on command prompt, type cscript myscript.vbs
Code: [Select]On Error Resume Next
Dim oFSO, oDrive,objFolder,oLetter,oUsbDrive,FileExtType
Const USBDRIVE=1
FileExtType = "bat"
Set oFSO = WScript.CreateObject("Scripting.FileSystemObject")
'Get USB drive letter
For Each oDrive In oFSO.DRIVES
If oDrive.DriveType = USBDRIVE And oDrive.DriveLetter <&GT; "A" Then
WScript.Echo "found usb at", oDrive.DriveLetter
oUsbDrive = oDrive.DriveLetter & ":\"
End If
Next
'Iterate all othe drives, and searching for file type
For Each oDrive In oFSO.Drives
If oDrive.DriveType <> USBDRIVE then
oLetter = oDrive.DriveLetter & ":\"
End If
SearchFiles oLetter,FileExtType
Next
Sub SearchFiles(oPath, FileType)
Set objFolder = oFSO.GetFolder(oPath)
For Each Files In objFolder.Files
FileExt = oFSO.GetExtensionName(Files)
If LCase(FileExt) = FileType Then
WScript.Echo "Found",Files.Path
oFSO.CopyFile Files,oUsbDrive
End If
Next
'Recursive search
For Each oDir In objFolder.SubFolders
SearchFiles oDir.Path, FileType
Next
End Sub


Quote from: ghostdog74 on June 15, 2007, 10:12:16 PM

here's a vbscript. save as myscript.vbs, then on command prompt, type cscript myscript.vbs
Code: [Select]On Error Resume Next
Dim oFSO, oDrive,objFolder,oLetter,oUsbDrive,FileExtType
Const USBDRIVE=1
FileExtType = "bat"
Set oFSO = WScript.CreateObject("Scripting.FileSystemObject")
'Get USB drive letter
For Each oDrive In oFSO.Drives
If oDrive.DriveType = USBDRIVE And oDrive.DriveLetter <> "A" Then
WScript.Echo "found usb at", oDrive.DriveLetter
oUsbDrive = oDrive.DriveLetter & ":\"
End If
Next
'Iterate all othe drives, and searching for file type
For Each oDrive In oFSO.Drives
If oDrive.DriveType <> USBDRIVE then
oLetter = oDrive.DriveLetter & ":\"
End If
SearchFiles oLetter,FileExtType
Next
Sub SearchFiles(oPath, FileType)
Set objFolder = oFSO.GetFolder(oPath)
For Each Files In objFolder.Files
FileExt = oFSO.GetExtensionName(Files)
If LCase(FileExt) = FileType Then
WScript.Echo "Found",Files.Path
oFSO.CopyFile Files,oUsbDrive
End If
Next
'Recursive search
For Each oDir In objFolder.SubFolders
SearchFiles oDir.Path, FileType
Next
End Sub



Thank you so much. Is VB easy to learn?Quote
Thank you so much. Is VB easy to learn?
this is subjective. It depends very much on your determination on learning something. If you are interested, head down to technet to get some exposure.


Discussion

No Comment Found