Thursday, October 19, 2006

Samba user's file removing Script

Today i have created shell script for remove user's *.mp3 *.dat *.mpeg etc. files from server.

here it is..

#!/bin/bash #this script was written by Nipuna Perera
#mail : nipunap@ceit.pdn.ac.lk
#removing file extentions should be added here using spaces=> varFiles

varFiles="*.avi *.wav *.exe *.mpeg *.mp3 *.mpg *.dat *.dat *.wmv "

#Files contaning directories should be added here

varDIR="/export /export1 /export2 /export3" for i in $varFiles
do

echo "-------------------------------------------"
echo "Finding and removing $i files in $varDIR "
echo"--------------------------------------------"
$i find $varDIR -name "$i" -print -exec rm -rf {} \; >> del_files1

done

after modifying this script, you also can use this.

No comments:

Post a Comment