> Phil Leinhauser wrote: >> > Phil Leinhauser wrote: >> >> Thanks for the info Dave. I did just what you described except I >> pushed >> >> it to a text file so I could see better what was happening. >> >> >> >> I ran it with the 5 day setting and didn't get anything. Then I >> dropped >> >> it to 2 days and got a list. The script is apparently working but >> only >> >> on about half of the domains. I have other domains that never made >> it >> >> into the output.txt file. I know there is trash there because I have >> >> one user with over 3000 messages. >> >> >> >> I guess now the question is, does the script just delete everything >> >> older than DELTIME? or is it looking for something to only get >> >> messages? I see in the output that it looks like it's going to >> delete >> >> some index and dovecot-uidlist files. Is this ok? >> > >> > It probably shouldn't delete these files, but I don't think it will >> hurt >> > anything. Dovecot is very robust and will fix things on the fly that >> get >> > wacked out. If you give me the exact file names I can add an >> exception >> > to the script. >> > >> >> What can I do to see >> >> why it's not finding all of the old messages?. >> > >> > Do you have this statement in your script?: >> > for each in "${PATH_TRASH}" ; do >> > Try removing the quotes and see if that fixes it. >> > >> > The qtp-clean-spam script had the same bug that was fixed last >> December. >> > Looks like I missed fixing the qtp-clean-trash script. >> > >> Eric, >> I removed the quotes and reran with the same results, still not finding >> all messages. >> >> Here are the control files names: >> courierimapacl >> courierimapuiddb >> dovecot.index.cache >> dovecot.index.log >> dovecot-uidlist >> maildirfolder >> All of these are in .Trash and all other folders (.Drafts, .etc) so a >> global exclude might be in order. You'll know better what can be >> deleted and what can stay. Since I'm now on dovecot I'm sure the >> courier files can go but it might be good to exclude the entire list for >> those who are still on courier. > > Thanks Phil. Can you try replacing > for each in "${PATH_TRASH}" ; do > FILES_TO_DELETE="`find ${each} -type f -ctime +$DELTIME`" > if [ -n "${FILES_TO_DELETE}" ]; then > for file in ${FILES_TO_DELETE} ; do > if [ -n ${file} ]; then > rm -f ${file} >/dev/null 2>&1 > fi > done > fi > done > with > for each in $PATH_TRASH; do > find $each -type -f -ctime +$DELTIME -exec rm -f {} \; > done > > The find command is quite powerful indeed. ;)
So now it looks like this: if [ -n "${PATH_TRASH}" ]; then for each in $PATH_TRASH; do find $each -type -f -ctime +$DELTIME -exec rm -f {} \; done fi But I get an error: find: invalid argument `-f' to `-type'