Since the data is in EXCEL, it is logical to write with VBA. The advantage of VBA is that the code is in EXCEL file, which is a friendly development and debugging environment. You can execute the code step by step and check the values of variables in the middle, which is convenient for correcting the program. I wrote a VBA code preliminarily by saving the file as XLAM format (a file with scripts) and pressing ALT+F11 to enter the VBA environment. Press CTRL+R to open the project manager, insert the module and paste the code, as shown in the following figure:
The code file is as follows (it is possible that the browser will steal special characters, so it must be combined with the above figure):
Option Explicit
Sub macro 1()
Dim arr, i, j, p, F
arr = active sheet. used range
for I = 2 toubound (arr)
' File renaming
p = "f: \ downloads \ 1 \"&; arr(i, 1)
f = Dir(p & "*.jpg")
j = 1
While f < > ""
Name p & f As p & arr(i, 2) & arr(i, 3) & j & ".jpg"
f = Dir
j = j+1
Wend
' folder was renamed
name p as p&; arr(i, 2)
Next i
End Sub