24 lines
		
	
	
		
			780 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			24 lines
		
	
	
		
			780 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
#!/bin/bash
 | 
						|
# (C) 2008 Michael Weinberger
 | 
						|
# See http://wiki.contribs.org/Dirty_Tools for full documentation
 | 
						|
 | 
						|
# Sometimes Dovecot index files are corrupted after a restore
 | 
						|
# It is save to delete them all. Dovecot will rebuild them when the mailbox is accessed.
 | 
						|
 | 
						|
echo "Deleting Dovecot's index files";
 | 
						|
 | 
						|
# Find users - also finds /home/e-smith/files/users
 | 
						|
USERS=`/usr/bin/find /home/e-smith/files/users -maxdepth 1 -type d`
 | 
						|
 | 
						|
# Add Admin dir
 | 
						|
USERS="/home/e-smith/ $USERS" # admin
 | 
						|
 | 
						|
for u in $USERS; do
 | 
						|
# Ignore dirs without Maildir
 | 
						|
	! /usr/bin/test -d $u/Maildir && continue
 | 
						|
	/usr/bin/find $u/Maildir -maxdepth 2 -type f -name "dovecot.index*" -exec /bin/rm -f '{}' \;
 | 
						|
	/usr/bin/find $u/Maildir -maxdepth 2 -type f -name ".imap.index*" -exec /bin/rm -f '{}' \;
 | 
						|
done
 | 
						|
 | 
						|
echo "Completed";
 |