make script deleting mp3 with warnig to users


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting make script deleting mp3 with warnig to users
# 1  
Old 11-23-2006
make script deleting mp3 with warnig to users

hi i need to make a script that will check the directories of the users on mp3 or mp4 files. if so they must be automaticly deleted and they have to get a warning message instead.

this should be running every day at 1 pm and should be done within the cron file.

could someone help me with this question?

if so your blessed.

yhnx in advance Smilie
# 2  
Old 11-23-2006
you can start using the "find" command. something like this:

Code:
find /home -name "*.mp[3-4]" -type f | xargs ls -l | awk '{ print $3 "," $9 }' > mpfiles.txt

for x in `cat mpfiles.txt`
do
	user=`echo ${x} | cut -f1 -d","`
	file=`echo ${x} | cut -f2 -d","`
	recipient=${user}@<domain>

	rm ${file}

	mail -s "File ${file} was deleted on your directory." ${recipient}
done

but if you want to delete without email this is much simplier:

Code:
find /home -name "*.mp[3-4]" -type f -exec rm{}\;

where /home is the starting directory of your users.

Last edited by inquirer; 11-23-2006 at 08:54 PM..
# 3  
Old 11-24-2006
thnx,

i already found out that i need to run the script within the cron file to let it happen every day at 13.00 o clock.

but i cant say enough to thank you
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. OS X (Apple)

Alternatives to GNU Make for users of newer OS X

As you may already know, Apple has integrated all the GNU developer tools into their own graphical development environment so you can no longer use them from the command line. This means that open source software that is distributed as source is inaccessible to users of newer versions of Mac OS X,... (4 Replies)
Discussion started by: Ultrix
4 Replies

2. UNIX for Dummies Questions & Answers

Command - filename as arguments - make executable to all users.

Edit: Sorry. Mistakenly posted - please delete (3 Replies)
Discussion started by: Reddax
3 Replies

3. UNIX and Linux Applications

How to make ldappasswd use {SHA} instead of {SSHA} for users passwords in openldap?

Is it possible to use {SHA} with ldappasswd? I didn't find responsible option in manual page and doc (1 Reply)
Discussion started by: urello
1 Replies

4. Shell Programming and Scripting

script to rename mp3 files

hi there, i'm using OS X. i have a bunch of mp3 files strewn across a directory tree that i'd like to rename. specifically i'd like to remove any track numbers and leading non-alphabetic characters from the filenames like this: 01 - song1.mp3 2 song2.mp3 become: song1.mp3... (6 Replies)
Discussion started by: creakyshrimp
6 Replies

5. Shell Programming and Scripting

automatic script for flac to mp3 conversion

used flac2mp3 (0 Replies)
Discussion started by: barrydocks
0 Replies

6. UNIX for Dummies Questions & Answers

how to make programs available to all users

Hi all, where (path) usually the programs are installed in linux. How to make installed programs available to all users of the system ? Thanks in advance! (4 Replies)
Discussion started by: lramsb4u
4 Replies

7. Shell Programming and Scripting

Deleting Inactive Solaris users

Hello, I want to do a search for users on my solaris boxes that have been inactive for a defined number of days and then delete them. Any ideas how to determine or calculate the number of days (possibly using the /var/adm/wtmpx file) from the user's last login to the current date of search. ... (0 Replies)
Discussion started by: prince2010
0 Replies

8. Shell Programming and Scripting

how to run script? call other script? su to another user? make a cron?

Good morning. I am searching for "how-to"'s for some particular questions: 1. How to write a script in HP-UX 11. 2. How to schedule a script. 3. How to "call" scripts from the original script. 4. How to su to another user from within a script. This is the basics of what the... (15 Replies)
Discussion started by: instant000
15 Replies

9. Shell Programming and Scripting

Shell Script help - MP3 Downloader using Wget

I want to make a script to use wget to find and download mp3s on a website into a directory with a name derived from that URL. So far I have: #!/bin/sh echo “MP3 Downloader” echo -n "Enter full URL address of website or website subdirectory > " read text cd ~ mkdir $text cd $text ... (3 Replies)
Discussion started by: Garnett
3 Replies

10. Solaris

How to make a script executable by all users?

I have a script in my home direcroty which upon execution gives the essential system information like memory,cpu etc and is currently owned by root:root. Now I want to see that every non root user will run this file and grab the reqired system info. I know this is some thing associated with chown... (2 Replies)
Discussion started by: chrs0302
2 Replies
Login or Register to Ask a Question