4,578,488 th visitor since 2017.2.1 ( Today : 88 )
Computer ???
No. 441
Name. swindler
Subject. Windows 서버에서 오래된 파일 삭제하는 명령
Main Cate. Win Server
Sub Cate.
Date. 2013-11-13 17:12
Hit. 5002 (211.36.27.3)
File.
Windows 서버에서 오래된 파일부터 삭제하는 좋은 명령이 있더군요.

> forfiles /P C:\reports /S /M *.zip /D -45 /C "cmd /c del @file"

(C:\reports 의 sub 디렉토리에 존재하는 *.zip 파일중 45 일 지난 파일을 삭제)

forfiles 라는 명령을 이용하면 오래된 로그파일 삭제등의 명령을 매우 간단하게 실행할 수 있습니다. (Windows 2003 Server 이상에서만 지원)



/P : 작업경로
/S : 서브폴더 포함
/M : searchmask 파일옵션 (기본이 *)
/D : 저정한 날짜, +-옵션 가능, -45이면 45일이전파일
/C : 실행할 명령어

[바로가기 링크] : http://coolx.net/cboard/computer/441



Name
Password
Comment
Copyright © 1999-2017, swindler. All rights reserved. 367,611 visitor ( 1999.1.8-2004.5.26 ), 2,405,771 ( -2017.01.31)

  2HLAB   2HLAB_Blog   RedToolBox   Omil   Omil_Blog