前端之家收集整理的这篇文章主要介绍了
文件夹及其子文件夹Copy VB.NET,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
- PrivateSubCopyDir(ByValsrcPathAsString,ByValaimPathAsString)
- Try
- IfaimPath.Substring(aimPath.Length-1)<>Path.DirectorySeparatorCharThen
- aimPath+=Path.DirectorySeparatorChar
- EndIf
- If(NotDirectory.Exists(srcPath))ThenExitSub
- DimfileList()AsString=Directory.GetFileSystemEntries(srcPath)
- ForEachFileNameAsStringInfileList
- IfDirectory.Exists(FileName)Then
- If(NotDirectory.Exists(aimPath+Path.GetFileName(FileName)))ThenDirectory.CreateDirectory(aimPath+Path.GetFileName(FileName))
- CopyDir(FileName,aimPath+Path.GetFileName(FileName))
- Else
- File.Copy(FileName,aimPath+Path.GetFileName(FileName),True)
- EndIf
- Next
- CatchexAsException
- Response.Write("<br>"+ex.ToString())
- EndTry
- EndSub
原文链接:https://www.f2er.com/vb/260962.html