944,098 Members | Top Members by Rank

Ad:
  • ASP.NET Discussion Thread
  • Unsolved
  • Views: 50469
  • ASP.NET RSS
Feb 24th, 2007
0

how to copy all files from one folder to another using system.io

Expand Post »
hi
I am working in asp.net,vb.net
I have to copy all files from 1 folder to another folder through coding using system.io

the files in the new folder should remain with the same name

how to do this.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
rinkuchoudhury is offline Offline
16 posts
since Jan 2007
Feb 27th, 2007
0

Re: how to copy all files from one folder to another using system.io

For Each f In Directory.GetFiles(sourcefolderpath)

file.copy(f,destination path)
Next
Reputation Points: 10
Solved Threads: 0
Light Poster
kapil.goyal is offline Offline
47 posts
since Jan 2007
Aug 24th, 2008
0

Re: how to copy all files from one folder to another using system.io

thank you
Reputation Points: 10
Solved Threads: 0
Newbie Poster
ajit2mail is offline Offline
3 posts
since Jun 2008
Dec 22nd, 2008
0

Re: how to copy all files from one folder to another using system.io

hi
I am working in asp.net,vb.net
I have to copy all files from 1 folder to another folder through coding using system.io

the files in the new folder should remain with the same name

how to do this.
--------------------------------------------------------------------------------

Here is VB code
asp.net Syntax (Toggle Plain Text)
  1. imports System.io
  2.  
  3. Public Shared Sub CopyFlashScriptFile(ByVal SourceDirectory As String, ByVal DestinationDirectory As String)
  4. Try
  5. Dim f() As String = Directory.GetFiles(SourceDirectory)
  6. For i As Integer = 0 To UBound(f)
  7. File.Copy(f(i), DestinationDirectory & "\" & fileNameWithoutThePath(f(i)))
  8. Next
  9. Catch ex As Exception
  10. End Try
  11. End Sub
  12.  
Last edited by peter_budo; Dec 29th, 2008 at 11:20 am. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
ajit2mail is offline Offline
3 posts
since Jun 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP.NET Forum Timeline: A Modern calendar control
Next Thread in ASP.NET Forum Timeline: Uploading Files to a server from a file upload control using ASP.net and VB





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC