Re: [CGUYS] UNIX Help -- Command Line Stuff
Some of this syntax is peculiar to the find command. Here is a good intro: http://www.athabascau.ca/html/depts/compserv/webunit/HOWTO/find.htm As far as how the -mtime option is used, I believe you are correct. Whoever gave you this advice was probably short at least 12 oz. of dark roast coffee. On 3/5/10, t.piwowar t...@tjpa.com wrote: The following was suggested to me for a cron job to delete old emails from a spam folder. I don't completely understand the syntax at the end of the line. find /home/user/mail/domain/email/.spam -type f +mtime 30 -exec rm -f '{}' \; should not +mtime 30 be -mtime +30 What does '{}' (quote lbrace rbrace quote) mean? What does the \ at the end mean? * ** List info, subscription management, list rules, archives, privacy ** ** policy, calmness, a member map, and more at http://www.cguys.org/ ** *
Re: [CGUYS] UNIX Help -- Command Line Stuff
On Fri, 5 Mar 2010, t.piwowar wrote: The following was suggested to me for a cron job to delete old emails from a spam folder. I don't completely understand the syntax at the end of the line. find /home/user/mail/domain/email/.spam -type f +mtime 30 -exec rm -f '{}' \; should not +mtime 30 be -mtime +30 Yes, it should be -mtime 30 if you want exactly 30 days +30 for 30 days and older -30 for 30 days and younger What does '{}' (quote lbrace rbrace quote) mean? You can skip the single quotes. {} means substitute what the find command found in earlier part, into the -exec section. What does the \ at the end mean? \; is the end of your -exec option. So, you could have another option after that (ie: ... -exec rm -f {} \; -print) However, this is a dangerous command. Run the following first to see what it does. If you like the output, run it with 'rm -f' instead of 'ls -l' find /some/path -type f -mtime +30 -exec ls -l {} \; * ** List info, subscription management, list rules, archives, privacy ** ** policy, calmness, a member map, and more at http://www.cguys.org/ ** *
Re: [CGUYS] UNIX Help -- Command Line Stuff
On Mar 5, 2010, at 2:24 PM, Michael Fernando wrote: However, this is a dangerous command. Run the following first to see what it does. If you like the output, run it with 'rm -f' instead of 'ls -l' Good advice that is. Thanks JE and MF. I feel in control now. * ** List info, subscription management, list rules, archives, privacy ** ** policy, calmness, a member map, and more at http://www.cguys.org/ ** *
Re: [CGUYS] UNIX Help -- Command Line Stuff
On Fri, 5 Mar 2010, t.piwowar wrote: The following was suggested to me for a cron job to delete old emails from a spam folder. I don't completely understand the syntax at the end of the line. find /home/user/mail/domain/email/.spam -type f +mtime 30 -exec rm -f '{}' \; should not +mtime 30 be -mtime +30 Yes, it should be -mtime 30 if you want exactly 30 days +30 for 30 days and older -30 for 30 days and younger What does '{}' (quote lbrace rbrace quote) mean? You can skip the single quotes. {} means substitute what the find command found in earlier part, into the -exec section. What does the \ at the end mean? \; is the end of your -exec option. So, you could have another option after that (ie: ... -exec rm -f {} \; -print) However, this is a dangerous command. Run the following first to see what it does. If you like the output, run it with 'rm -f' instead of 'ls -l' find /some/path -type f -mtime +30 -exec ls -l {} \; * ** List info, subscription management, list rules, archives, privacy ** ** policy, calmness, a member map, and more at http://www.cguys.org/ ** *
[CGUYS] UNIX Help -- Command Line Stuff
The following was suggested to me for a cron job to delete old emails from a spam folder. I don't completely understand the syntax at the end of the line. find /home/user/mail/domain/email/.spam -type f +mtime 30 -exec rm -f '{}' \; should not +mtime 30 be -mtime +30 What does '{}' (quote lbrace rbrace quote) mean? What does the \ at the end mean? * ** List info, subscription management, list rules, archives, privacy ** ** policy, calmness, a member map, and more at http://www.cguys.org/ ** *