rodrigosantosbr

Como excluir arquivos antigos ou mais novos do que n dias usando find

Mar 6th, 2021 (edited)
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
find /directory/path/ -mindepth 1 -mtime +N -delete

Para excluir todos os arquivos e pastas com mais de 10 dias da pasta ~/Downloads

find ~/Downloads -mindepth 1 -mtime +10 -delete

Para excluir todos os arquivos e pastas mais novos do que N dias, use -N em vez de +N

Para manter os subdiretorios vazios:

find /directory/path/ -mindepth 1 -type f -mtime +N -delete

-type f to match only regular files.
-type d to match folders
-type l to match symbolic links.

Add Comment
Please, Sign In to add comment