내 무선 툴킷의 캐시 폴더에 있는 모든 폴더와 파일을 삭제하는 배치 파일을 갖고 싶습니다.
현재 다음과 같은 파일이 있습니다:
cd "C:\Users\tbrollo\j2mewtk\2.5.2\appdb\RMS"
del *.db
이렇게 하면 내 RMS 디렉터리에 있는 모든 .db 파일이 삭제되지만, 이 디렉터리에서 모든 항목을 삭제하고 싶습니다. 어떻게 하면 되나요?
'만' 가 아니라 파일 삭제 del . 서브디렉토리가. Dos 기술 대한 내용을 디렉터리인 이 스크립트입니다 사용할 수 있습니다.
@echo off
setlocal enableextensions
if {%1}=={} goto :HELP
if {%1}=={/?} goto :HELP
goto :START
:HELP
echo Usage: %~n0 directory-name
echo.
echo Empties the contents of the specified directory,
echo WITHOUT CONFIRMATION. USE EXTREME CAUTION!
goto :DONE
:START
pushd %1 || goto :DONE
rd /q /s . 2> NUL
popd
:DONE
endlocal
그냥 이거 동업이요 뭐로부터요 morty346 게시하기를:
set folder="C:\test"
IF EXIST "%folder%" (
cd /d %folder%
for /F "delims=" %%i in ('dir /b') do (rmdir "%%i" /s/q || del "%%i" /s/q)
)
It 는 해당 폴더가 정의되어 있는 가변적입니다 빠른 확인 및 deletes 변경 내용을 먼저 디렉토리를 폴더에서는.
이렇게 할 수 있습니다 '델' 와 '/ S' 를 사용하여 플래깅 (알 수 있는 모든 파일을 모든 재귀 redhat. 서브디렉토리가):
del /S C:\Path\to\directory\*
연구개발 (r&d) 이 명령을 사용할 수도 있다. 재귀 없이 조용히 삭제하시겠습니까 프롬프트합니다:
@RD /S /Q %VAR_PATH%
사용
set dir="Your Folder Path Here"
rmdir /s %dir%
mkdir %dir%
이 버전은 deletes 물어보지 않고.
set dir="Your Folder Here"
rmdir /s /q %dir%
mkdir %dir%
예:
set dir="C:\foo1\foo\foo\foo3"
rmdir /s /q %dir%
mkdir %dir%
그러면 'C:\foo1\foo\foo\foo3'.
sub> <; (싶다 언급하십시오 [압둘라 Sabouin& # 39 의 오토메이티드] [1]. 나에 대해 mix up there was a 저놈이오 복사 내가 범하지 표시문 그의 사후, 제가 여러분께 감사합니다 멜포메네 대한 오류를 지적하며!) < /sub>;
[1]: # 44578851 https://stackoverflow.com/questions/6836566/batch-file-delete-all-files-and-folders-in-a-directory/44578851
그냥 수정된 버전의 [GregM& # 39 의 오토메이티드] [1]:
set folder="C:\test"
cd /D %folder%
if NOT %errorlevel% == 0 (exit /b 1)
echo Entire content of %cd% will be deleted. Press Ctrl-C to abort
pause
REM First the directories /ad option of dir
for /F "delims=" %%i in ('dir /b /ad') do (echo rmdir "%%i" /s/q)
REM Now the files /a-d option of dir
for /F "delims=" %%i in ('dir /b /a-d') do (echo del "%%i" /q)
REM To deactivate simulation mode remove the word 'echo' before 'rmdir' and 'del'.
[1]: # 16462274 https://stackoverflow.com/questions/6836566/batch-file-delete-all-files-and-folders-in-a-directory/16462274
모든 파일을 삭제하기 위해 이 명령을 실행해야 합니다.
del*.*
@echo off
@color 0A
echo Deleting logs
rmdir /S/Q c:\log\
ping 1.1.1.1 -n 5 -w 1000 > nul
echo Adding log folder back
md c:\log\
Right track 에서 있습니다. 폴더 원하는거요 폐기됩니다 추가하기만 추가 코드를 다시.