[K12OSN] shell script to remove contents of several files

Olle Niit olle at paalalinn.com
Fri May 19 12:38:28 UTC 2006

My example, save it to filename.txt and
chmod +x filename.txt
and modify it to your needs.

copy all lines between

# A simple script to remove all you want to remove.

cd /home
for user in `ls -d *` 
	echo "Deleting all old office from user folder $user"
	cd $user
	rm -r -f .rhopenoffice1.1
	rm -r -f .openoffice
	rm -r -f OpenOffice
	rm -r -f OpenOffice.org1.1.0
	rm -r -f OpenOffice.org1.1.1
	rm -r -f OpenOffice.org1.1.2
	rm -r -f OpenOffice.org1.1.3
	cd ..


Barry Cisna wrote:

>Hello All,
>Due to the fact ,that I am not smart enough, would someone be able to
>give an example of a shell script that would remove the contents of each
>users, email folder,( but of course leave the user's folder on the
>system). I'm wanting to "clean out" everyone's email at the end of the
>school year.
>In other words something like delete contents
>of /var/mail/allusers<folder contents>.
>I'm not sure of correct syntax of "rm" or "shred"
>Thanks again,
>Barry Cisna
>K12OSN mailing list
>K12OSN at redhat.com
>For more info see <http://www.k12os.org>

More information about the K12OSN mailing list