Page 1 of 1

output end-level empty subfolders

Posted: 10 Dec 2012 07:43
by taherkhani
how can i list my empty folders and subfolders in a main folder?

supose that my main folder is:

f:\ta\a\main\sub1\
f:\ta\a\main\sub2\subsub1
f:\ta\a\main\sub3\subsub2
f:\ta\a\main\sub4\subsub3\subsubsub1
f:\ta\a\main\sub5\subsub4\subsubsub1

supose that folder 'main' is completely empty.

i want a program that output a list of end-level empty subfolders, i mean in this example,
output these .txt file:

f:\ta\a\main\sub1\
f:\ta\a\main\sub2\subsub1
f:\ta\a\main\sub3\subsub2
f:\ta\a\main\sub4\subsub3\subsubsub1
f:\ta\a\main\sub5\subsub4\subsubsub1

and don't output these line:

f:\ta\a\main
f:\ta\a\main\sub2
f:\ta\a\main\sub3
f:\ta\a\main\sub4
f:\ta\a\main\sub4\subsub3
f:\ta\a\main\sub5
f:\ta\a\main\sub5\subsub4

Re: output end-level empty subfolders

Posted: 10 Dec 2012 14:15
by taherkhani
this program can job that, but don't work for unicode character:

http://simonwai.com/bin/EmptyFolderNuker.exe

Re: output end-level empty subfolders

Posted: 10 Dec 2012 17:44
by abc0502
The problem is in the cmd window, it can't display unicode character, try to out-put the result to a txt file and open the file after it is done, maybe that might work.

Edited:
This work for me

Code: Select all

@ECHO OFF
Del /F /Q "log.log" 2>nul
For /F "delims=" %%A in ('DIR /B /S "*.*"') Do echo %%A>>log.log
log.log

Put it in the main folder

Re: output end-level empty subfolders

Posted: 11 Dec 2012 00:30
by taherkhani
@abc0502,
thanks, but my output isn't that i'm goal. I upload log file:

http://letitbit.net/download/38559.3ecbb4bfb7a29b5aa42071b98829/log.log.html

Re: output end-level empty subfolders

Posted: 11 Dec 2012 01:23
by abc0502
sorry, this website is annoying, upload to any other website. and explain what exactly you mean.

Re: output end-level empty subfolders

Posted: 11 Dec 2012 02:33
by taherkhani
log file:
http://depositfiles.com/files/lo3etp4yc

i want output only empty folders that even have not any folder in it.

supose I have:

main
|_subfol
|_subsubfol

and main is empty folder, itmeans that subfol and subsubfol are also empty, but main contain a foder and subfol contain a folder too,
I have just the path empty folders that contain anything.
In this example i want output :

main\subfol\subsubfol

Re: output end-level empty subfolders

Posted: 11 Dec 2012 02:41
by abc0502
Sorry, do you mean you just want to display the last folder in the tree of all folders.
and empty means that the folder must not contain any other sub-folders ?

Re: output end-level empty subfolders

Posted: 11 Dec 2012 02:53
by taherkhani
Sorry, do you mean you just want to display the last folder in the tree of all folders.
and empty means that the folder must not contain any other sub-folders ?


Exactly.

Re: output end-level empty subfolders

Posted: 11 Dec 2012 03:33
by foxidrive
Do you want to display them or do you want to delete them?

Re: output end-level empty subfolders

Posted: 11 Dec 2012 03:43
by taherkhani
@foxidrive
Do you want to display them or do you want to delete them?


I want display them too a .txt file.

Re: output end-level empty subfolders

Posted: 11 Dec 2012 04:08
by foxidrive
See if this works for you:

Code: Select all

@echo off
for /d /r %%a in (*) do (
dir /b /a "%%a" 2>nul | find /c /v "" | findstr "^0$" >nul && >> file.txt echo %%a
)
pause

Re: output end-level empty subfolders

Posted: 11 Dec 2012 04:11
by abc0502
nice one Foxidrive, mine reached 10 lines and didn't complete yet :lol:

Re: output end-level empty subfolders

Posted: 11 Dec 2012 06:48
by taherkhani
See if this works for you:

Code:
@echo off
for /d /r %%a in (*) do (
dir /b /a "%%a" 2>nul | find /c /v "" | findstr "^0$" >nul && >> file.txt echo %%a
)
pause


it's work, but not for unicode, if i run that for unicode, output ? character instead of any unicode character like this:

D:\a\07 ?????? - ??? ???? ??-????\04 ???????\??? ???\358.30 ?????? ??? (1)
D:\a\07 ?????? - ??? ???? ??-????\04 ???????\??? ???\358.54 ??? ??? ????? ???????
D:\a\07 ?????? - ??? ???? ??-????\04 ???????\??? ???\359.38 ?????? ?????? ????? (???????)
D:\a\07 ?????? - ??? ???? ??-????\04 ???????\??? ???\359.39 ??????? ??????? ???????
D:\a\07 ?????? - ??? ???? ??-????\04 ???????\??? ???\359.40 ?????? ??????? ???????
D:\a\07 ?????? - ??? ???? ??-????\04 ???????\??? ???\359.54 ????? 2
D:\a\07 ?????? - ??? ???? ??-????\04 ???????\??? ???\450.7 ???? ??? ???? ???? ????? 3
D:\a\07 ?????? - ??? ???? ??-????\04 ???????\??? ???\461.3 ???? ??? ??????? ??????
D:\a\07 ?????? - ??? ???? ??-????\04 ???????\??? ???\482.8 ????? 3(???????)
D:\a\07 ?????? - ??? ???? ??-????\04 ???????\??? ???\490.6 ?????? ??? ???????
D:\a\07 ?????? - ??? ???? ??-????\04 ???????\??? ???\492.9 ??? ???????
D:\a\07 ?????? - ??? ???? ??-????\04 ???????\??? ???\494.6 ??????? ??????
D:\a\07 ?????? - ??? ???? ??-????\04 ???????\??? ???\494.9 ?????? ??????? ??????
D:\a\07 ?????? - ??? ???? ??-????\04 ???????\??? ???\495.8 ??????? ??????
D:\a\07 ?????? - ??? ???? ??-????\04 ???????\??? ???\496 ?????? ??????? ??????
D:\a\07 ?????? - ??? ???? ??-????\04 ???????\??? ???\496.6 ?????? ??? (2)
D:\a\07 ?????? - ??? ???? ??-????\04 ???????\??? ???\497 ???? ??? ???????

Re: output end-level empty subfolders

Posted: 11 Dec 2012 07:03
by abc0502
it work for me here, does the notepad is supporting the language that your folders is named with?

Follow these steps:
1> Control panel
2> Regional and language options
3> select 3rd tab "advanced"
4> choose your language in "language for non-unicode programs" section and then reboot.

also, make sure that in the 2nd tab "languages" in supplemental language support section, the 1st choice is choosed "install files for complex script and right-to-left language..." if your language is wrote from right-to left

That might be the reason why the notepad doesn't display the characters in correct format.