We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

File.move

Andre_p
Andre_p asked
on
Medium Priority
365 Views
Last Modified: 2012-05-11
Hi there
I am trying to use the move command to move a folder, i have used the code from MSDN and it work pretty well just one problem the file is moved but there is no data inside the moved file. I am sure it is something small but is missing it, here i my code
Try
                If File.Exists(path) = False Then
                    ' This statement ensures that the file is created,
                    ' but the handle is not kept.
                    Dim fs As FileStream = File.Create(path1)
                    fs.Close()
                End If

                ' Ensure that the target does not exist.
                If File.Exists(path2) Then
                    File.Delete(path2)
                End If

                ' Move the file.
                File.Move(path1, path2)

            Catch

            End Try

Open in new window

Comment
Watch Question

CERTIFIED EXPERT
Most Valuable Expert 2012
Top Expert 2014
Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview
Full Stack .NET Developer
Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview
Carlos VillegasFull Stack .NET Developer

Commented:
Ignore last sentence:
, result file in path2 is empty.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.