So let's start with a giant pile of files that need to be renamed that have unpredictable filenames and file extensions.
Let's say I can pull a report in excel format out of the system that generated those files. It will tell me the (unique) first five characters of the unpredictable filename and includes some other data that I'm putting in the filename to make it human-readable.
I can, and already do, use a series of vlookups and concatenate functions to generate command line "ren" commands to get sensible filenames. (e.g. ="ren """&A1&"."&B1&""" """&A1&" - "&C1&" - "&D1&"."&B1&"""" yields a value of ren "asdfg.doc" "asdfg - file #10 - the quick brown fox.doc") which I then copy back into the command line. But I'd like to automate it further if possible.
Problem #1: Can I open a command line at the location of the active workbook, cd into a subdirectory, run a dir /b, and feed the results back into column A of the active workbook?
Problem #2: Can I automatically send the previously discussed ren commands back to the command line?
Thanks in advance![]()
Bookmarks