[CMD실행]
forfiles
> 파일 폴더 검색 후 명령실행
옵션:
/s
> 하위폴더 포함
/m
> 검색할 파일명
/p
> 검색 위치 지정
/d
> 파일 검색 날짜 설정
/c
> 실행할 명령어
명령에 지정된 변수들
@FILE
File name.
@FNAME
File name without extension.
@EXT
File name extension.
@PATH
Full path of the file.
@RELPATH
Relative path of the file.
@ISDIR
Evaluates to TRUE if a file type is a directory. Otherwise, this variable evaluates to FALSE.
@FSIZE
File size, in bytes.
@FDATE
Last modified date stamp on the file.
@FTIME
Last modified time stamp on the file.
예)
forfiles /p "c:\" /s /m "test*.txt" /d -7 /c "cmd /c del @file"
> c:\(하위폴더포함)에서 test로 시작되고 확장자가 txt인 파일 중 실행시간으로 7일이 지난 파일을 전부 삭제
참고)
"cmd /c 명령은 명령을 실행하고 바로 종료한다는 뜻"
참조)
http://technet.microsoft.com/de-de/library/cc753551(v=ws.10).aspx
'IT > Windows' 카테고리의 다른 글
윈도우 부팅 시간 확인 (0) | 2015.03.20 |
---|---|
윈도우 CMD 명령어 모음 (0) | 2015.03.20 |
윈도우 실행 명령어 모음 (0) | 2015.03.20 |
dir: 폴더 파일 정보 확인(용량, 파일 개수) (0) | 2015.03.20 |
del, rd: 파일 및 폴더 삭제 (0) | 2015.03.20 |