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 :
#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

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


after modifying this script, you also can use this.

No comments:

Post a Comment