In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces VB. NET file operation syntax which, the text is very detailed, has a certain reference value, interested friends must read!
1. Copy a file (FileCopy statement)
Format: FileCopy(source filename),(destination filename)
Function: can copy the source file to the target file, copy the contents of the two files exactly the same.
Note: Open files cannot be copied. Copy files cannot contain wildcards (★ or?).
For example:
FileCopy''A1.doc". "A2.doc"
Copies a file in the current directory to another file in the same directory.
For example, if you copy a file from one directory to another, you must include path information.
FileCopy''D:\VB\A1.doc". ''D:\VBl\A1.doc"
VB does not provide a statement to move files. In fact, you can move files by copying them with FileCopy statements and then deleting the source file name with Kill statements.
2. Delete files (Kill statement)
Format: Kill(file name)
Function: Use this statement to delete the specified file.
Note: File name can contain a path.
For example:
Kill"D:\VB\★.bak--
The backup files in the VB directory of drive D will be deleted.
The: Kill statement has a certain "danger" because there is no prompt when executing the statement. To be on the safe side, when using this statement in an application, be sure to give the appropriate prompt before deleting VB. NET files.
3. File (Directory) Rename (Name statement)
Format: Name(original file name)As(new file name)
Function: can rename files or directories, can also be used to move files.
Note: The new filename cannot be an existing filename. Wildcards "six" and "?" cannot be used in the original and new file names. "。
For example:
Name "A2.doc"As"B2.doe''
In general, the "old filename" and the "new filename" must be on the same drive. If the path specified by New File Name exists and differs from the path specified by Old File Name, the Name statement moves the file to the new directory and changes the VB. NET file name. If New File Name and Old File Name specify a different path but the same file name, the Name statement moves the file to the new directory without changing the file name. For example:
Name"D:\VBl\A1.FRM"As"D:\VB2\A1.FRM"
The A1.FRM file will be moved down from the VBl directory to the VB2 directory, and the A1.FRM file in the VBl directory will be deleted.
Another example:
Name"D:\VBl\A1.FRM"As"D:\VB2\A2.FRM"
Move the original file from the VBL directory to the VB2 directory and rename it.
The Name statement allows you to move files, not directories, but you can rename directories.
For example:
Name"D:\VBl"As"D:\VB2"
Rename directory VBL to VB2
The above is "VB. NET file operation syntax what" all the content of this article, thank you for reading! Hope to share the content to help everyone, more relevant knowledge, welcome to pay attention to 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.