日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
教你更快速使用VB.NET文件夾操作

文件夾這個(gè)概念大家都很熟悉,在各各操作系統(tǒng)中都有文件夾這個(gè)概念,而在VB.NET這門開發(fā)語言中如何更好更安全的操作文件夾,這就是今天我們要來演示的一個(gè)案例。希望從VB.NET文件夾操作這個(gè)案例中學(xué)到技巧。

創(chuàng)新互聯(lián)是一家專業(yè)從事成都網(wǎng)站制作、網(wǎng)站設(shè)計(jì)的網(wǎng)絡(luò)公司。作為專業(yè)網(wǎng)絡(luò)公司,創(chuàng)新互聯(lián)依托的技術(shù)實(shí)力、以及多年的網(wǎng)站運(yùn)營經(jīng)驗(yàn),為您提供專業(yè)的成都網(wǎng)站建設(shè)、成都全網(wǎng)營銷推廣及網(wǎng)站設(shè)計(jì)開發(fā)服務(wù)!

VB.NET文件夾操作代碼:

 
 
 
  1. '文件夾復(fù)制  
  2. Function CopyDir()Function CopyDir(ByVal sourcePath As String, ByVal targetPath As String) As Boolean  
  3. Try  
  4. '檢查目標(biāo)目錄是否以目錄分割字符結(jié)束,不是則添加  
  5. If Right(targetPath, 1) <> "" Then targetPath += ""  
  6. '判斷目標(biāo)目錄是否存在,不存在則新建  
  7. If Not Directory.Exists(targetPath) Then Directory.CreateDirectory(targetPath)  
  8. ' 得到源目錄的文件列表,該里面是包含文件以及目錄路徑的一個(gè)數(shù)組  
  9. Dim fileList As String() = Directory.GetFileSystemEntries(sourcePath)  
  10. '遍歷所有的文件和目錄  
  11. For Each filepath As String In fileList  
  12. '目錄處理,遞歸  
  13. If (Directory.Exists(filepath)) Then  
  14. CopyDir(filepath, targetPath + Path.GetFileName(filepath))  
  15. Else  
  16. '復(fù)制文件  
  17. File.Copy(filepath, targetPath + Path.GetFileName(filepath), True)  
  18. End If  
  19. Next  
  20. Return True  
  21. Catch ex As Exception  
  22. Return False  
  23. End Try  
  24. End Function  
  25. '文件夾刪除  
  26. Function DelDir()Function DelDir(ByVal targetPath As String) As Boolean  
  27. Try  
  28. '檢查目標(biāo)目錄是否以目錄分割字符結(jié)束,不是則添加  
  29. If Right(targetPath, 1) <> "" Then targetPath += ""  
  30. '得到源目錄的文件列表,該里面是包含文件以及目錄路徑的一個(gè)數(shù)組  
  31. Dim fileList As String() = Directory.GetFileSystemEntries(targetPath)  
  32. '遍歷所有的文件和目錄  
  33. For Each filepath As String In fileList  
  34. '目錄處理,遞歸  
  35. If (Directory.Exists(filepath)) Then  
  36. DelDir(targetPath + Path.GetFileName(filepath))  
  37. Else  
  38. '刪除文件  
  39. File.Delete(targetPath + Path.GetFileName(filepath))  
  40. End If  
  41. Next  
  42. '刪除文件夾  
  43. System.IO.Directory.Delete(targetPath, True)  
  44. Return True  
  45. Catch ex As Exception  
  46. Return False  
  47. End Try  
  48. End Function 

以上就是我為大家提高的關(guān)于VB.NET文件夾操作的一個(gè)案例,大家快試試吧!


分享題目:教你更快速使用VB.NET文件夾操作
鏈接地址:http://m.5511xx.com/article/cdcdjhg.html