Monday, April 4, 2011

scan music file

This will teach how to scan all music file under a folder and send out the result to your email as attachment

First you will need to install (for Centos5)
- sharutils
- mailt

For Centos6, just install
- sharutils

Below is the script:

#! /bin/sh

find /users -iname "*.mp3" > /var/log/music.txt
find /users -iname "*.wma" >> /var/log/music.txt
find /users -iname "*.mp4" >> /var/log/music.txt

find /export -iname "*.mp3" >> /var/log/music.txt
find /export -iname "*.wma" >> /var/log/music.txt
find /export -iname "*.mp4" >> /var/log/music.txt

uuencode /var/log/music.txt /var/log/music.txt | mail -s "[My-Domain] music file"

the send out email attachment usage is

uuencode "file location" "file location" | mail -s "subject" "email address"

No comments:

Post a Comment