I'm trying to remove all mp3's in subdirectories

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting I'm trying to remove all mp3's in subdirectories
# 1  
Old 07-21-2011
I'm trying to remove all mp3's in subdirectories

My company has a policy that employees can't keep music on our servers so im looking for a line or script that I can run as part of a cron job that will remove all mp3's in the users home directories.

Does anyone have any idea how I might accomplish this?
# 2  
Old 07-21-2011
find /home -name "*.mp3" -exec rm -f {} \;

This User Gave Thanks to bartus11 For This Post:
# 3  
Old 07-21-2011
Originally Posted by bartus11
find /home -name "*.mp3" -exec rm -f {} \;

Thanks for that. Would it be possible to add a second variable to that line? For example if I wanted to remove all MP3's and WAV's?
# 4  
Old 07-21-2011
find /home -type f \( -name "*.mp3" -o -name "*.wav" \) -exec rm -f {} \;

Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Remove all the subdirectories except latest 5 inside any given directory

I Want to remove all the sub-directories except latest five in any given TGTDIR. Is there a way to do so without making a cd to TGTDIR? I have tried the following but not worked. Thank you. rm -rf `ls -t $TGTDIR | awk 'NR>5'` (20 Replies)
Discussion started by: Devendra Hupri
20 Replies

2. Shell Programming and Scripting

List files with *.i extension in a directory and all its subdirectories + 30days old then remove

I need to write a script to : list files with *.i extension in a directory and all its subdirectories + 30days old, save it in a file and then remove (2 Replies)
Discussion started by: lena keung
2 Replies

3. Shell Programming and Scripting

Remove files from subdirectories given a list of filenames

Dear all, I have a dir structure like main_dir At_nn Ag_js Nf_hc .... mcd32 mgd43... mcd32 mgd43... mcd32 mgd43... and each subdir (e.g. mcd32, mgd43) contains files. Now, i... (15 Replies)
Discussion started by: yogeshkumkar
15 Replies

4. Shell Programming and Scripting

How to remove ^M characters recusrsively from all subdirectories and file in directry

Hi, First apologies for starting the old issue (already discussed in this forum). How can I remove ^M characters from a directory which contains lot of subdirectory and files (this includes jar, war, .xml, .properties etc). Noticeable is that, all files might not contain ^M characters. ... (3 Replies)
Discussion started by: bhaskar_m
3 Replies

5. Shell Programming and Scripting

Batch MP3 transcoding.

Hello everyone, I've made a script and I want to share and get new ideas for improving it. So far, the script 1. Searches a directory tree for MP3 files; 2. Check their bitrates; 3. Change any bitrate higher than 128 kbps to VBR 4 (It ignores files with a bitrate lower or equal to 128, as... (3 Replies)
Discussion started by: lvxferre
3 Replies

6. UNIX for Dummies Questions & Answers

How to remove directory with subdirectories and files?

I'm trying to remove several directories which contains sun-dirs and files inside. I used the command rm -r <dirname> But, it always ask "examine file in directory <dirname> yes/no?" line by line. So, i need to write "y" for every line. How can i skip this step and remove all directories with... (9 Replies)
Discussion started by: ppa108
9 Replies

7. Shell Programming and Scripting

How to Remove Ctrl M characters in files from directories and its subdirectories

Hi, How to recursively remove Ctrl M characters in files from a directory and its sub directory ? I know unix2dos command is there but to remove in bunch of files ... ? Thanks (7 Replies)
Discussion started by: skdp
7 Replies

8. UNIX for Dummies Questions & Answers

mp3 codec

I just need a mp3 codec that will decode mp3s so I can play them with my media player (probably going to be using XMMS) (0 Replies)
Discussion started by: Synbios
0 Replies

9. Shell Programming and Scripting

Sorting mp3

Hi all... Here's my question: -> considering i've got thousands of mp3s', named like "Artist name - Track Name", how could i write a shell (ksh, or bash my favorite, not knowinf enough any other language) that would create a directory (if not existing already) with the Artist's name, and move... (3 Replies)
Discussion started by: penguin-friend
3 Replies
Login or Register to Ask a Question