forfile을 사용하여 파일 삭제

forfile을 사용하여 파일 삭제

"archive"라는 디렉터리에서 파일을 삭제해 보세요. 각 디렉토리를 구체적으로 입력하지 않고는 이 작업을 수행하는 방법을 알 수 없습니다. 일련번호(12345)를 가진 디렉토리 아래에 다른 디렉토리가 있습니다.

예제 항목은 다음과 같습니다. .\customer\12345\archive .\customer2\54321\archive

forfiles /p "." /s /m "*.zip" /d -90 -c "cmd /c del @path"

나는 본 적이https://serverfault.com/questions/49614/delete-files-older-than-x-days,https://stackoverflow.com/questions/9746778/ms-dos-batch-delete-old-files-in-directory/9747065#9747065그리고https://stackoverflow.com/questions/324267/batch-file-to-delete-files-older-than-a-specified-date/1180746#1180746아무 소용이 없다

티아

답변1

이것이 당신에게 효과가 있는지 확인하십시오. 비슷한 방법을 사용하여 로그 파일을 지웁니다.

forfiles /P C:\pathtofile /S /D -90 /M *.zip /C "cmd /c del @file"

관련 정보