In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
Editor to share with you how to use VB.NET 's FileInfo class to manipulate files, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
VB.NET FileInfo example
Copy a file
Dim fFile1 As New FileInfo ("C:abc1.txt") fFile1.CopyTo ("C:abc2.txt", True)
We define the fFile1 variable as a FileInfo object and set it to point to a directory in the file system. To copy a file, we use the CopyTo method in the FileInfo object and indicate the full name of the target file we plan to copy.
Move a file
Dim fFile1 As New FileInfo ("C:abc1.txt") fFile1.MoveTo ("C:abc3.txt")
We define the fFile1 variable as a FileInfo object and set it to point to a directory in the file system. To copy a file, we use the CopyTo method in the FileInfo object and indicate the full name of the target file we plan to move.
Delete a file
Dim fFile1 As New FileInfo ("C:abc1.txt") fFile1.Delete ()
We define the fFile1 variable as a FileInfo object and set it to point to a directory in the file system. To delete a file, we use the Delete method in the FileInfo object.
VB.NET FileInfo DirectoryInfo example
Move a folder
Dim dDir1 As New DirectoryInfo ("C:Folder1") dDir1.MoveTo ("C:Folder2")
We define the dDir1 variable as a DirectoryInfo object and set it to point to a directory in the file system. To move a folder, we use the MoveTo method of the DirectoryInfo object and indicate the full target path of the folder we are moving.
Delete a folder
Dim dDir1 As New DirectoryInfo ("C:Folder1") dDir1.Delete ()
We define the dDir1 variable as a DirectoryInfo object and set it to point to a directory in the file system. To delete a folder, we use the Delete method of the DirectoryInfo object. You can only delete an empty folder, and if the folder contains files, you will not be able to delete it until you empty it. )
The above is all the contents of the article "how to use VB.NET 's FileInfo class to manipulate files". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.