Bulk file naming from a list
Philobae
Posted messages
1
Status
Member
-
contrariness Posted messages 17905 Registration date Status Member Last intervention -
contrariness Posted messages 17905 Registration date Status Member Last intervention -
Hello,
Here is my problem:
On one side, I have a large number of files (800) each with a specific name and on the other side, an Excel file containing the list of these files in one column and in another column a new name that I would like to assign to each file.
Is there a way to automatically rename these files?
Thank you
Here is my problem:
On one side, I have a large number of files (800) each with a specific name and on the other side, an Excel file containing the list of these files in one column and in another column a new name that I would like to assign to each file.
Is there a way to automatically rename these files?
Thank you
5 answers
-
Hello,
Here is an example of a macro that does the job:Sub Rename_files()
Dim Path As String
Path = "C:\Users\.....\"
For row = 1 To 800
Name Path & Cells(row, 1) As Path & Cells(row, 2)
Next row
End Sub
In Path, you need to put the path of the directory containing the files to be renamed.
In my example, the old name (with the extension) is in column A and the new name (also with the extension) is in column B.
You just need to adapt it.
Maybe include error handling if a file does not exist.
See you later
Best regards,