Copy file from from one folder to another folder with rename
-
Hi. i have one folder ABC --1.txt --2.txt I have to copy this file to another folder XYZ --11.txt --12.txt how can achive this task in vb.net.... Regards, Hemant Patel.
-
Hi. i have one folder ABC --1.txt --2.txt I have to copy this file to another folder XYZ --11.txt --12.txt how can achive this task in vb.net.... Regards, Hemant Patel.
-
Hi. i have one folder ABC --1.txt --2.txt I have to copy this file to another folder XYZ --11.txt --12.txt how can achive this task in vb.net.... Regards, Hemant Patel.
You mean both the folders in the server ??? If so, why dont you use File.Copy(path1,path2) :thumbsup::thumbsup:
Abhishek Sur
My Latest Articles **Create CLR objects in SQL Server 2005 C# Uncommon Keywords Read/Write Excel using OleDB
**Don't forget to click "Good Answer" if you like to.
-
Hi. i have one folder ABC --1.txt --2.txt I have to copy this file to another folder XYZ --11.txt --12.txt how can achive this task in vb.net.... Regards, Hemant Patel.
Hemant_ec48 wrote:
how can achive this task in vb.net....
Here is the way.
using System.IO
Public Sub CopyDir(ByVal strSrc As String, ByVal strDest As String)
Dim dirInfo As New DirectoryInfo(strSrc)
Dim fsInfo As FileSystemInfo
If Not Directory.Exists(strDest) Then
Directory.CreateDirectory(strDest)
End If
For Each fsInfo In dirInfo.GetFileSystemInfos
Dim strDestFileName As String = Path.Combine(strDest, fsInfo.Name)
If TypeOf fsInfo Is FileInfo Then
File.Copy(fsInfo.FullName, strDestFileName, True)
'This will overwrite files that already exist
Else
CopyDir(fsInfo.FullName, strDestFileName)
End If
Next
End SubBut,as CG suggested this has nothing to with ASP.NET. You should always ask the question in proper fourm to get the better answer. Thanks !
Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you.