2016년 10월 19일 수요일

Remove all files created before a certain date


http://unix.stackexchange.com/questions/102752/remove-all-files-created-before-a-certain-date

Using find is still the preferred way of deleting files. See http://mywiki.wooledge.org/UsingFind for more.

One way of doing this is to create a file with the time-stamp in it. e.g

$ touch -t 201311220000 /tmp/timestamp

Now delete the files GNUfind (assuming in the current directory) that match the time-stamp e.g:

$ find . -type f ! -newer /tmp/timestamp -delete

or non GNU find

$ find . -type f ! -newer /tmp/timestamp -exec rm {} \;

2016년 10월 18일 화요일