i searched a bit but i cant find something useful.

i need to take my files to filestream (i can do this with file paths)
and i wanna save this files to somewhere else on my program. Is it possible that with the using FileStream?

THX for Replys ^^

Recommended Answers

All 2 Replies

If you wanna move or copy files from one location to another using your program, there are easier ways than using FileStream.

Imports System.IO

    Private Sub FileCopy()
        Dim strFileSource As String = "C:\Temp\sourceFile.txt"
        Dim strFileDestination As String = "C:\Temp\destinationFile.txt"

        File.Copy(strFileSource, strFileDestination)
    End Sub

    Private Sub FileMove()
        Dim strFileSource As String = "C:\Temp\sourceFile.txt"
        Dim strFileDestination As String = "C:\Temp\destinationFile.txt"

        File.Move(strFileSource, strFileDestination)
    End Sub

    Private Sub CopyMoveMultipleFiles()
        Dim strSourceDirectory As String = "C:\Temp"
        Dim strDestinationDirectory As String = "C:\SecondaryTemp"
        Dim di As New DirectoryInfo(strSourceDirectory)

        'To copy files
        For Each fi As FileInfo In di.GetFiles
            fi.CopyTo(strDestinationDirectory & "\" & fi.Name)
        Next

        'To move files
        For Each fi As FileInfo In di.GetFiles
            fi.MoveTo(strDestinationDirectory & "\" & fi.Name)
        Next
    End Sub

ok thx a lot :) it's enough for me

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.