re: How to add a prefix to all files and folders in a folder? (windows)
I am trying to create a .bat file which will rename a predefined folder structure with a project number prefix eg. project name/admin - becomes - 7000-01 project name/7000-01 admin. Here is what I have so far:
@Echo off
pushd
for /d %%g in (*) do ren "%%g" "7000-01 %%g"
Which works only for the top level but I would like it to rename all sub-folders (including those below the 'admin' level in the eg. above.)
I read here - https://ss64.com/nt/for_d.html that using for /d /r should work to recursively rename all sub-folders, but I cannot get it to work.
FYI the pushd is used so the .bat name stays the same.