Another update from ingydotnet^djgoku
This commit is contained in:
parent
91df62d461
commit
948b86eafa
7604 changed files with 108452 additions and 22726 deletions
30
Task/Empty-directory/Batch-File/empty-directory.bat
Normal file
30
Task/Empty-directory/Batch-File/empty-directory.bat
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
@echo off
|
||||
if "%~1"=="" exit /b 3
|
||||
set "samp_path=%~1"
|
||||
set "tst_var="
|
||||
|
||||
%== Store the current directory of the CMD ==%
|
||||
for /f %%T in ('cd') do set curr_dir=%%T
|
||||
|
||||
%== Go to the samp_path ==%
|
||||
cd %samp_path% 2>nul ||goto :folder_not_found
|
||||
|
||||
%== The current directory is now samp_path ==%
|
||||
%== Scan what is inside samp_path ==%
|
||||
for /f "usebackq delims=" %%D in (
|
||||
`dir /b 2^>nul ^& dir /b /ah 2^>nul`
|
||||
) do set "tst_var=1"
|
||||
|
||||
if "%tst_var%"=="1" (
|
||||
echo "%samp_path%" is NOT empty.
|
||||
cd %curr_dir%
|
||||
exit /b 1
|
||||
) else (
|
||||
echo "%samp_path%" is empty.
|
||||
cd %curr_dir%
|
||||
exit /b 0
|
||||
)
|
||||
|
||||
:folder_not_found
|
||||
echo Folder not found.
|
||||
exit /b 2
|
||||
Loading…
Add table
Add a link
Reference in a new issue