Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save suya55/fd281a1fe3b9e1a9825e to your computer and use it in GitHub Desktop.
Save suya55/fd281a1fe3b9e1a9825e to your computer and use it in GitHub Desktop.
[cron] 파일 생성 날짜를 기준으로 마지막 10개의 파일만 유지 하는 크론
0 1 * * * rm -rf `ls /path/* -t | awk 'NR>10'`
또는
0 1 * * * ls -1dt /path/* | tail -n +11 | xargs rm -rf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment