move Folder
-
hi all i have problem with folder I have folder name "A" contain 10 file and 3 folder other and in there folder contain any file How can i move folder "A" to orther folder
In ASP.NET, you're not going to do any moving of files and folders at all, unless you need to do this on the server for some reason ?
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
hi all i have problem with folder I have folder name "A" contain 10 file and 3 folder other and in there folder contain any file How can i move folder "A" to orther folder
/// <summary> /// Move Directory /// </summary> /// <param name="SourcPath">Source Directory </param> /// <param name="DestPath">Destination Directory</param> public void MoveDir(string SourcPath, string DestPath) { DirectoryInfo dirInfo = new DirectoryInfo(SourcPath); //FileSystemInfo finfo; string destiFile; if (!Directory.Exists(DestPath)) Directory.CreateDirectory(DestPath); foreach(FileSystemInfo finfo in dirInfo.GetFileSystemInfos()) { destiFile=Path.Combine(DestPath,finfo.Name); if ((FileSystemInfo)finfo is FileInfo) File.Move(finfo.FullName, destiFile); else MoveDir(finfo.FullName, destiFile); } }
U can use this way, you need little bit of modification of code to remove the folder, else it working fine !!!!!Best Regards ----------------- Abhijit Jana View My CodeProject Articles "Success is Journey it's not a destination"
-
/// <summary> /// Move Directory /// </summary> /// <param name="SourcPath">Source Directory </param> /// <param name="DestPath">Destination Directory</param> public void MoveDir(string SourcPath, string DestPath) { DirectoryInfo dirInfo = new DirectoryInfo(SourcPath); //FileSystemInfo finfo; string destiFile; if (!Directory.Exists(DestPath)) Directory.CreateDirectory(DestPath); foreach(FileSystemInfo finfo in dirInfo.GetFileSystemInfos()) { destiFile=Path.Combine(DestPath,finfo.Name); if ((FileSystemInfo)finfo is FileInfo) File.Move(finfo.FullName, destiFile); else MoveDir(finfo.FullName, destiFile); } }
U can use this way, you need little bit of modification of code to remove the folder, else it working fine !!!!!Best Regards ----------------- Abhijit Jana View My CodeProject Articles "Success is Journey it's not a destination"