windows - Replace part of a folder and its subfolders names using batch? -


i have folder structure on computer in form e.g. "photos" subfolders "summer 2012" "winter 2012" , have further subfolders. want place name "david" before each folder name i.e. "david photos" "david summer 2012" etc. . there batch file can write this? last attempt following:

for /d /r %%g in ("\\sampledrive\photos") (ren "%%g" "dan%%g") 

however command window said syntax of command incorrect

thank in advance help!

using ren "%%g" "david %%g" rename folder "david \sampledrive\photos", cmd returns syntax incorrect. use %%~nxg instead, indicates folder, not path.

@echo off  /d /r "\sampledrive\photos" %%g in (*) (      ren "%%g" "david %%~nxg" ) echo finished! pause >nul 

Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -