Winform applets ------ batch rename final versions

Source: Internet
Author: User

I. Pre-knowledge a and DirectoryInfo classes for batch renaming

Public instance methods used to create, move, and enumerate directories and subdirectories. This class cannot be inherited.

Use the DirectoryInfo class for typical operations, such as copying, moving, renaming, creating, and deleting directories.
If you want to reuse an object multiple times, consider using the instance method of DirectoryInfo, instead of the corresponding static method of the Directory class, because it is not always
Security check is required.

B, FileInfo

FileInfo. MoveTo moves the specified file to a new location and provides the option to specify a new file name.

In C #, when renaming a file, there is no rename function. The FileInfo. MoveTo method is used, and a new name is added to the original directory by MoveTo to rename the file.

FileInfo. MoveTo: moves the specified file to a new location and provides the option to specify a new file name. Therefore, it can be used to rename the file without changing the bit
Set );

DirectoryInfo. GetFiles (): gets the files in the directory (excluding subdirectories). The returned type is FileInfo []. Wildcards are supported;

C, Conbobox. Selectedxxxx

D, Path. Combine

Method -- combines 2-4 strings into a path

E, LastIndexOf

Int g = tests. LastIndexOf ("//", 5, tests. Length-5 );
Search from left to right of the tests string "//", returns the last
"//" Position in the string

 

Ii. Related

ReNameFile0.0.6.zip is added to include the original name, removing the first 10 digits of the original name and the Service website. It is fixed that the starting range of the serial number is increased to 20 due to the incorrect order of naming by character in the second order.

Iii. Related code
                                        btn_rename_Click(.btn_rename.Visible = =  idx = fix = (FileInfo fi  di.GetFiles())                 toFileName = .tb_fixed.Text +                fi.MoveTo(Path.Combine(fi.DirectoryName, toFileName +++                                      btn_path_Click(             (openFileDialogSearch.ShowDialog() === openFileDialogSearch.FileName;                   i = path.LastIndexOf(                path = path.Substring(.btn_rename.Visible =                                       Rename_Load(            List<> moved =  List<> ( i = ; i <= ; i++=.btn_rename.Visible = .Text = 

Iv. program functions

Function: Name all files in the folder in a fixed format + number. Update the function: name all the files in the folder in a fixed format + the original name (used when there is a serial number before the original name)

1. Open the renamefile.exe program and run it.
2. Notes:
A. Select the first file under the folder you want to execute as the first file named, such as XXX0.txt.
B. If the file name is the same as the one you named, no

V. program download

Copy and paste the following address to the browser URL to download: (first version) http://files.cnblogs.com/hongmaju/ReName.zip (expired)

(Second Edition) http://files.cnblogs.com/hongmaju/Rename0.0.2.zip (expired)

(3) http://files.cnblogs.com/hongmaju/Rename0.0.3.zip (expired)

(Version 4) http://files.cnblogs.com/hongmaju/ReNameFile0.0.4.zip (expired)

(Fifth edition) http://files.cnblogs.com/hongmaju/ReNameFile0.0.5.zip (expired)

(Final) http://files.cnblogs.com/hongmaju/ReNameFile0.0.6.zip (normal download)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.