Rename directories and sub directories that do not contain files.
Posted: 20 May 2018 21:24
Hi guys,
I am wondering if there is a way to:
Rename Folders that are empty or only contain Folders with "name + (Empty)" etc
So that if I am browsing through directories I can tell quickly if they're useful or dead legs. (I want to keep the folder structure as it is, to add things into the correct folders as projects develop.)
eg:
My idea it is to use something like:
Where "???" I am not sure what to use.
I am wondering if there is a way to:
Rename Folders that are empty or only contain Folders with "name + (Empty)" etc
So that if I am browsing through directories I can tell quickly if they're useful or dead legs. (I want to keep the folder structure as it is, to add things into the correct folders as projects develop.)
eg:
- E:\AS\A\A
E:\AS\A\A\C
E:\AS\A\B
E:\AS\A\B\Work.doc
E:\AS\B\A
E:\AS\B\B
E:\AS\B\B\C
- E:\AS\A\A (Empty)
E:\AS\A\A (Empty)\C (Empty)
E:\AS\A\B
E:\AS\A\B\Work.doc
E:\AS\B (Empty)\A (Empty)
E:\AS\B (Empty)\B (Empty)
E:\AS\B (Empty)\B (Empty)\C (Empty)
My idea it is to use something like:
Code: Select all
@echo off
setlocal enabledelayedexpansion
cls
:input
set /p "input=1. Enter Source directory: "
if not exist "%input%" echo Invalid source: "%input%" enter valid path && goto :input
for /f "delims=" %%I in (' dir /s /b /o:n ') do (
set file="%%~I"
for %%J in ??? do set "file=???"
???
)