본문 바로가기
작업실

windows powershell 을 이용하여 이전 날짜 파일 삭제 하기

by 솥에 2013. 6. 26.
반응형



windows powershell 을 이용하여 이전 날짜 파일 삭제 하기


1. windows powersehll 설치


2. shell 작성


 - 기본적인 삭제 방법


http://technet.microsoft.com/en-us/library/ee176938.aspx


Remove-Item 경로/파일명.txt


Remove-Item c:\scripts\test.txt


Remove-Item c:\scripts\*


-> 삭제시 전부 삭제 할껀지 아니면 취소 할껀지를 물어봄


물어보지 않고 다 삭제 방법


Remove-Item c:\scripts\* -recurse



Remove-Item c:\scripts\* -exclude *.wav


모든 파일을 삭제 하지만 *.wav wav 파일은 제외



Remove-Item c:\scripts\* -include .wav,.mp3


모든 파일을 삭제 하지만 모든 wav,mp3 파일은 제외


Remove-Item c:\scripts\* -include *.txt -exclude *test*


모든 파일을 삭제 test단어가 들어가는 파일은 제외


Remove-Item c:\scripts\*.vbs -whatif


모든 vbs 삭제시 삭제되는 파일을 보여줌.


Remove-Item alias:\show


별칭 보여줌


Set-Location env:\


power shell 시작 위치 지정


=================================================================


http://www.networknet.nl/apps/wp/published/powershell-delete-files-older-than-x-days


delete files older than x days


X일자 이전 파일 삭제


반응형

'작업실' 카테고리의 다른 글

리눅스에서 text file vs DB  (0) 2014.02.25
putty ssh key 삭제  (0) 2014.02.03
windows 파일 삭제 스케쥴러 use to java  (0) 2013.06.26
JPS 사용법 - java  (0) 2013.06.20
Google keyword tool API 사용하기  (0) 2013.06.20