Exclude files if specific folder name
Posted: 05 Feb 2021 05:43
Hello,
This code below changes .dll files into .bak files in BaseFolder and its subfolders.
I just want to exclude files whose folder containing them has a specific name, let's say there is a subfolder called "DoNotModify".
This code below changes .dll files into .bak files in BaseFolder and its subfolders.
I just want to exclude files whose folder containing them has a specific name, let's say there is a subfolder called "DoNotModify".
Code: Select all
set folder=My\BaseFolder\
pushd "!folder!"
set "folderpath=!cd!"
if not "!folder:~-1!"=="\" set "folder=!folder!\"
for /R %%f in (*.dll) do (
ren "%%f" *.bak
)
popd