PDA

View Full Version : File renaming



Ani
03-07-2018, 03:24 AM
I need a VBA code that renames all files within a chosen folder and/or within its subfolders that match given extension/s that i may give in cells or in code array like:
extensions = Array("jpg","png","bpm")
Files new name must match parent folder name.
i also have to give it an name extender like:
extender = "_" + cstr(counter)
where counter in this example is used to count files to be renamed in that folder.
names for all images in subfolder "FName" after code is runned must be:
FName_1.png
FName_2.png
FName_3.png

If the code runs again in the same folder i want it to skip (not change) already named images only search if there are new ones to be renamed and set counter to respective value for that folder.

thank you for viewing/reading this post
Thank you in advance for your help

werafa
03-10-2018, 01:55 AM
Hi Ani,

i've not used this command, but it appears that you can use


Name sOldName As sNewName

everything else you have described, you will have to manage in excel.
eg, record all renamed files in an additional column

Ani
03-10-2018, 04:16 AM
Hi Ani,

i've not used this command, but it appears that you can use


Name sOldName As sNewName

everything else you have described, you will have to manage in excel.
eg, record all renamed files in an additional column

O Yes that seems to solve it. will leave this thread open until i finish the code and post it.
Thank you!