I encountered an issue by renaming files within a loop, I inadvertently removed their extensions. This became problematic as the loop iterates through various file types such as PDFs or Excel files. Could someone please advise on how to extract the file extension during the loop for each specific file, and then ensure it’s added back to the filename when renaming? I tried adding a split function within the renaming of the file name, but it came with an error. Any help or guidance would be appreciated. Thank you!


Report
All responses (
Answers (