Creating a desktop notepad, copy paste the following into Notepad, Notepad will modify the name for the bat to expand, then the file into the directory you need to perform the double-click.
OFF @echo setlocal enabledelayedexpansion del / QC: \ empty_dir del / QC: \ directory.txt the REM following code plus Sort / R & lt, reverses the order represents the folder. Subfolders former parent folder in the post. the dir / A: D / B / S " . " | Sort / R & lt> " % CD% \ directory.txt " for / F " the usebackq delims = " %% I in ( " directory.txt " ) do ( REM echo " dir IS the Enter: %% i " REM cd " %% i " echo REM " The path BAT IS:% ~ F0 " REM Print the this batfile ' S Whole path. echo " CUR the dir IS: " %% I "" the REM all print files in the current directory to the following file: the dir / A / B " %% I " > " C: \ folder_content.txt " REM echo " =============================== ======================== " REM echo " ================== fold Content: the begin ================= " : of the type " c: \ folder_content.txt" echo REM " ================== fold Content: End ================= " REM echo " ==== ================================================== = " REM the following findstr command to find whether there is the current file content, if the search is successful representing the directory is not empty, otherwise it is empty. REM Note that the following two ' and ' two ' or ' symbols. the findstr. " C: \ folder_content.txt " > NUL 2 > NUL && (echo " of The Folder " %% I " IS the NOT the NOT the NOT empty " ) || (echo " is empty" && echo "%%i">>"%cd%\empty_dir" && rd "%%i") del "c:\folder_content.txt" ) del "%cd%\directory.txt"