Batch rename file name small software

Source: Internet
Author: User

say in front

First of all, if not the development of Android, to use this small software, you can directly to the following topic

In Android development, there are times when a large number of files need to be renamed, especially some picture files. There are two of students have encountered this situation, I have not met, but this situation will certainly meet.

can be resolved with batch command (Move,ren), but to a write command, write the modified file name, but also write the original file name. If some of the modified names are directly a001.txt,a002.txt,a003.txt, ... There is no doubt that such a regular name, with the almighty Excel solve the fastest, a drag on the fix. Previously also wrote similar batch modification software, although the function is different, but the core principle is the same. For a long time did not write VB, writing really awkward. Accustomed to AS (Android Studio), feel that this is a heaven, a hell.

In the existing case, if the file is referenced and needs to be renamed, only one change (WIN:SHIFT+F6) can be made in the. But if the file is not yet referenced and needs to be renamed, you can use this little software to help you.

Originally to upload to csdn resources, but always pop-up let me log in. Click "OK" still not, also can't close the page, do not know the thought is in the virus. Fortunately, we are all experienced people, a tick, the last page shows the server exception. Tried many times can not, finally give up, to the embrace of Baidu Cloud

back to the chase

: Http://pan.baidu.com/s/1qYGJ3VQ

After decompression, there is an. xls file, which is called small software. The other is the Folders folder, which is used to store files that need to be renamed.

Attention:
1. Excel files and folder folders must be in the same directory
2. Do not rename the folder name

Operation Steps:
"1" Open Excel, you can see the gorgeous page came out

"2" but to complete the function, you need to open the macro manually. This warning will pop up above, click "Enable Content" to

"3" Put your files in the folder

"4" Click the button "Get All Files in folder"
All the filenames in the folder will be displayed, such as the picture in step 1. Sometimes you just need to modify the old name to a little bit, in order to reduce the workload, the new name and the new name is also filled with the suffix name of the old name

"5" modifies the new name (the execution result after ⊙﹏⊙ B is not present until the next modification of the name, Sorry)

"6" Click "Batch Change file name", the folder files will be a makeover

OK, finished ...

Gift Benefits

In addition to this basic function, there are two additional features:

A, in addition to the new name and suffix can be edited outside, the others are forbidden to edit, in order to prevent one of your careless. But you can adjust the width to give you a better visual view of the super long name

B, the new name if there is the same (because you have not seen in which folder there are two of the same file name), will be reported red warning, give you a warm hint.

year-end awards

Android development process, if there is no big God's open source projects, we do not know where to go. Support OpenSource

Option Explicit '************************************************' Get all the files in the folder directory '************************************************Sub Getfiles_click ()Dim mypath$, myfile$, Eachwirexls as WorkbookDim num%num = 0' Get the folder file path under the software directoryMyPath = thisworkbook.path & "/folder/"On Error GoTo error_handleCall unlocksheet ' unlockWith Application.ThisWorkbook.ActiveSheet' Clear all cell rangesRange ("a3:f65536") = ""' Get all the files in the pathmyFile = Dir (MyPath, vbnormal)Do Until Len (myFile) = 0num = num + 1Cells (num + 2, 1) = num' Debug.Print myFile ' Immediate Window test print resultsDim temp as VariantDim results () as Stringtemp = Splitsuffix (myFile)results () = tempCells (num + 2, 2) = results (1)Cells (num + 2, 4) = results (1)Cells (num + 2, 3) = results (2)Cells (num + 2, 5) = results (2)myFile = DirLoop' Debug.Print MyFileEnd withCall LocksheetMsgBox "find" & num & "Files"Exit SubError_handle:Call LocksheetMsgBox "Failed to find file, please check"End Sub '************************************************' Get the suffix name in the file name '************************************************Private Function Splitsuffix (fileName as String) as VariantDim sum%, location%, i%Dim Results (2) as Stringresults (1) = FileNameresults (2) = ""sum = Len (fileName)Location = 0for i = sum to 1 Step-1If Mid (FileName, I, 1) = "." ThenLocation = iGoTo End_handleEnd IfNextEnd_handle:If location <> 0 Thenresults (1) = left (filename, location-1) ' File nameresults (2) = Right (FileName, sum-location + 1) ' File suffix nameEnd IfSplitsuffix = ResultsEnd Function '************************************************' Batch modify file name '************************************************Sub Rename_click ()Dim mypath$, i%MyPath = thisworkbook.path & "/folder/"Call UnlocksheetWith Application.ThisWorkbook.ActiveSheet        . Unprotectfor i = 3 to [A65536]. End (3). RowName MyPath & Trim (Cells (I, 2)) & Trim (Cells (I, 3)) as MyPath & trim (Cells (I, 4)) & Trim (C Ells (i, 5))Cells (i, 6) = "OK"NextEnd withCall LocksheetMsgBox "Batch modification complete"End Sub '************************************************' Work table unlocked '************************************************Private function Unlocksheet () Application.ThisWorkbook.ActiveSheet.UnprotectEnd function '************************************************' Work table locked '************************************************Private Sub locksheet () Application.ThisWorkbook.ActiveSheet.Protect drawingobjects:=false, Contents:=true, scenarios:= _False, Allowformattingcolumns:=true, Allowdeletingrows:=true, _allowfiltering:=trueEnd Sub

Batch rename file name small software

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.