Answer the question
In order to leave comments, you need to log in
How to delete files from a folder?
Guys tell me how to delete files from a folder for a certain period? Are files for 2012 2013 2014 in the same folder?
Answer the question
In order to leave comments, you need to log in
find /var/spool/asterisk/monitor -mtime +182 -exec rm {} \; and if so? delete files older than 180 days
MaxDukov
Max Max
yes. the only thing - I strongly advise you to do not rm before deleting, but ls for a start - you will see a list of files that fall under the condition
[[email protected] ~]$ find /tmp -maxdepth 1 -type f -printf "%TY %p\n" | awk '$1 >= 2014{print "rm -f " $2}'
rm -f /tmp/.ktorrent_kde4_1000.lock
rm -f /tmp/.XauthFnlUja
rm -f /tmp/winstone152624632382939548.jar
rm -f /tmp/akuma8236603350544705032jar
rm -f /tmp/jna3326402736412458495jar
rm -f /tmp/.X0-lock
[[email protected] ~]$
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question