VB.Net File Extraction Question Please Help!!!

Hi all, im absolutley new to programming and thought I'd try out VB.Net.
What im trying to do is develop a program which will locate a certain file type (.jpeg for example) which is in a folder designated by the user. It will then take all files with that file extension and extract them to a designated folder. Any help would be greatly appreciated! Any snippits of code that might work would help tons especially considered the hazy details of my project.

Any idea of what vb.net command is used to extract a file?

Thanks All!!

Comments

  • Well I aint gonna hand you a solution but I got some advice:
    GOALS: Add these to "to Do" in Visual Studio (bottom left)
    1. Select Source
    2. Select Destination
    3. Filter (find) files of that extension
    4. Move them from source to destination

    So, lets create our form. On this form place

    -text box 1 - Source
    -text box 2 - Destination
    -button 1 - Move

    How do you access the values? Value = Textbox1.Text (Dim Value As String first)
    If you feel adventurous, skip step 1 and add File Browser to your form instead of text box 1. Where? Anywhere - it doesn't show up.
    Now add a button to get it in place of the text box 1.

    Double click the button and add this text:

    Dim Result As DialogResult
    OpenFileDialog1.FileName = Label1.Text
    OpenFileDialog1.Filter = "Jpeg files (*.jpg)|*.jpg|GIF files (*.gif)|*.gif|Bit Map Files (*.bmp)|*.bmp|Windows Meta Files (*.wmf)|*.wmf|Icon Files (*.ico)|*.ico|All Files (*.*)|*.*"
    Result = OpenFileDialog1.ShowDialog()
    If Result = DialogResult.OK Then
    Dim StrFileName = OpenFileDialog1.FileName

    Else
    MsgBox("Not quite certain, eh?")
    End If
    You don't have to do that though.

    So now on to finding and filtering the files - step 2:

    There are different ways to do this also. The easier way, like the file open dialog, is more challenging conceptually... so lets start the hard way and then build up if you have the time.

    The command is called DIR.
    What you are looking for is a recursive (includes sub directories) searcher.... or, better yet - NOT recursive. That's easier.

    So when you find the files, you can either
    -Store them in a list box which is invisuble (and thus learn about list boxes, focusing just on this piece of code for now and not the moving)
    Or
    -Move them immediately.

    Step 3:
    How do you move them?
    File.Move(Source, Destination)

    Then it might be nice to pop up a MsgBox("That was fun!")

    How do you find out about Dir?
    Type it in to visual studio. Enable Dynamic help (if it isn't already) by clicking Help-Dynamic Help.

    Didn't help?

    Well you know what to search for.

    Good luck!
    -Mike "MC5" C




    : Hi all, im absolutley new to programming and thought I'd try out VB.Net.
    : What im trying to do is develop a program which will locate a certain file type (.jpeg for example) which is in a folder designated by the user. It will then take all files with that file extension and extract them to a designated folder. Any help would be greatly appreciated! Any snippits of code that might work would help tons especially considered the hazy details of my project.
    :
    : Any idea of what vb.net command is used to extract a file?
    :
    : Thanks All!!
    :

  • : Hi all, im absolutley new to programming and thought I'd try out VB.Net.
    : What im trying to do is develop a program which will locate a certain file type (.jpeg for example) which is in a folder designated by the user. It will then take all files with that file extension and extract them to a designated folder. Any help would be greatly appreciated! Any snippits of code that might work would help tons especially considered the hazy details of my project.
    :
    : Any idea of what vb.net command is used to extract a file?
    :
    : Thanks All!!
    :

    There are alot of functions for scrolling through directories and files under the System.IO namespace. You can filter out files in a directory and copy files from one folder to another. You can also use stream objects to open the actual files, but just to do bit by bit copies. No way to actually see the encoding of a JPEG.

    Using the System.Drawing namespace is a good place to start if you want to perform graphics operations, such as manipulating existing images and dynamically creating images on the fly.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories