move file to a directory

Hi everyone,

i’d like to move files from a directory to another directory, with move() or copy() i can only move a file to another file. Can you tell me how i can solve this problem please.

Thankyou


Answer this question

move file to a directory

  • Sugan

    Thanks for your reply, i just want to move some of files in one directory to another directory, not directory to directory. Have you an algorithment or idee

    thanks in advance




  • BilalShouman

    Hi,

    Do you mean you wish to move all files from a directory in one go

    You could use Microsoft.VisualBasic.FileIO.FileSystem.MoveDirectory()

    but remeber to add Microsoft.VisualBasic as a refrence.

    Regards


  • dferraro

    ok well you can use the System.IO.File.Move(sourceFile, DestinationFile); method to move the file from one directory to another.

  • pc_bond

    you really shouldnt be adding references from a different language/using a different language assembly. It's not recommended.

    you can move all files from a directory, by going through each file/folder and moving it/copying it. Take a look at this:

    http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=711713&SiteID=1

    the above link copies files and directories.

    To move directories:

     

    System.IO.Directory.Move(Source, Destination)

     

     



  • SB1

    Hi ahmedilyas,

    thankyou very much for your help! that works for me.





  • move file to a directory