|
-
Apr 21st, 2003, 07:48 PM
#1
Thread Starter
Member
Searching Hard Drive for Certain Files then Writing to Server
I have a couple of questions that maybe you guys can help me out with. I am trying to create an app that will search HDD for certain file extensions. Once it searches it displays its results in a textbox. Now there are a couple of variables Like OS version, Secondary Partitions, and Profiles locations (all Windows). The user of this app will run this program to do a search on certain file extensions but also it will need to copy everything under the profile directory. Once it has run its search and the list of files found appear in the textbox the user should be able to select which files he/she would like to transfer up to a server. On the server a folder containing the Network Name of the computer should be created with the files that were selected to be transferred.
I have started some of the app but alot of functionality is missing like how to transfer and search, and also how to get the network name of the pc:
Thanks
Private Sub cmdSearch_Click()
Dim netid As String
Dim FE As String
Dim Profile As String
Dim Store As String
Dim Parlet As String
Dim Partition As String
Dim OS As String
Dim SearchResults As String
FE = "*.dbt, *.fds, *.pst, *.pab, *.xls, *.doc, *.mdb, *.dbf, *.ppt, *.tpm, *.msg, *.zbd, *.z20, *bookmark*"
netid =
OS = txtOS.Text
Parlet = txtParlet.Text
Partition = txtPartition.Text
If OS = "NT" Then
Profile = "C:\WINNT\Profiles"
Else: Profile = "C:\Documents and Settings"
End Sub
Last edited by jora; Apr 21st, 2003 at 08:03 PM.
-
Apr 21st, 2003, 08:11 PM
#2
Why not create and shell a batch file to do a DOS search and
output the results to a textfile. Then readin the textfile contents
into a listview and let the user select the files to transfer over to
the server?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Apr 21st, 2003, 08:18 PM
#3
Thread Starter
Member
Only thing is
The only thing I can see a problem with is the current system in place runs a batch file. This exe the batch file calls misses 3/4 of those file extensions.
Im up for anything that works do you possibly have a sample of how to do the search of the harddrive/partition, and transfer of the selected files?
Thanks
-
Apr 21st, 2003, 08:25 PM
#4
Sometimes it's good to do a search before you post...
I've replyed to someone else a while ago with simmilar problem
http://vbforums.com/showthread.php?s=&threadid=234853
-
Apr 21st, 2003, 08:47 PM
#5
Thread Starter
Member
Selecting the files and writing to server
Okay thank you...
What about selecting the files that this search pulls up then writing those files to a server.
-
Apr 21st, 2003, 09:02 PM
#6
Here you go. My suggestion is to either get each extension
separately or bring it all in and filter upon display in vb.
It depends upon the size of the drive, but this goes quite fast.
Code:
'Code for the batch file.
'%1 is the first parameter passed in.
@echo off
Dir %1 /s /a > C:\SearchResults.txt
Then vb code to execute the batch.
You need one form, one textbox (Text1), one command button (Command1).
You will need to do better error trapping though.
You will get the picture.
Perhaps replacing the textbox with a drive listbox and a
multi select combobox for the extensions.
Code:
Option Explicit
Private Sub Command1_Click()
Dim lRetVal As Long
Dim sSearch As String
If InStr(2, Text1.Text, ":\", vbTextCompare) = 2 Then
sSearch = Trim(Text1.Text & "")
lRetVal = Shell("C:\Search.bat " & sSearch, vbNormalFocus)
If lRetVal > 0 Then
MsgBox "Sucessful search", vbOKOnly + vbInformation
Else
MsgBox "Search Failed!", vbOKOnly + vbCritical
End If
Else
MsgBox "Incorrect format!", vbOKOnly + vbInformation
End If
End Sub
This will do a fast DOS search and pump the results into SearchResults.txt
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Apr 21st, 2003, 09:20 PM
#7
Thread Starter
Member
Just reading the code
Thanks for the assistance in this. I read the code and basically I have to store this batch file on the drive of every computer I have to do this to? Its alot of computers attatched to this network. Basically if im reading correctly, the individual will put the file extension they want to search into the text box then click the command button? Every time I tried to put an extension in the text box it keeps giving me the error Incorrect format.
-
Apr 21st, 2003, 09:25 PM
#8
Enter in the textbox - "C:\*.txt"
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Apr 22nd, 2003, 07:15 AM
#9
Thread Starter
Member
Now once this search is completed
Once the search is done and the user selects the files he/she wants to move to the server...How would you go about storing those certain files to a server with the name \\Server1\Migration$\NAME OF COMPU SYSTEM FILES WERE STORED ON.
-
Apr 22nd, 2003, 10:03 AM
#10
If you are using something like a listview to allow the users to
select the files, then just loop through the listview (or other
control) and perform a move of the files in the list.
Code:
FileMove (C:\File1.txt, "\\Server1\Migration$\NAME OF COMPU SYSTEM FILES WERE STORED ON")
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|