help for simple script

Forum rules
Before you post please read how to get help
kaizer
Level 2
Level 2
Posts: 80
Joined: Wed Feb 16, 2011 8:49 am

help for simple script

Postby kaizer » Fri Jul 22, 2011 2:22 pm

hello need help for create what I believe should be a simple script...
I am using both lmde and mac os x (need it for ipad ans apple tv...) and I recently messed up my itunes library by duplicating tons of songs !
I need a script to look in a folder for every files ending by 1.mp3 (duplicate) and 1.aac in that folder and subfolders and to delete them.
Thank you in advance for your help

User avatar
richyrich
Level 16
Level 16
Posts: 6959
Joined: Mon May 04, 2009 8:31 pm

Re: help for simple script

Postby richyrich » Fri Jul 22, 2011 2:46 pm

Might find something in the sandbox here . . http://bashscripts.org/forum/viewforum.php?f=7

steev
Level 1
Level 1
Posts: 26
Joined: Wed Mar 16, 2011 11:50 pm

Re: help for simple script

Postby steev » Fri Jul 22, 2011 2:52 pm

You can do this with the find command

Use this to see which files will be deleted:

Code: Select all

find /path/to/music_folder -type f \( -iname "*1.mp3" -o -iname "*1.aac" \) -print


If the output of the above command looks right, use this to delete them:

Code: Select all

find /path/to/music_folder -type f \( -iname "*1.mp3" -o -iname "*1.aac" \) -delete

User avatar
Habitual
Level 12
Level 12
Posts: 4104
Joined: Sun Nov 21, 2010 8:31 pm
Location: Youngstown, Ohio

Re: help for simple script

Postby Habitual » Fri Jul 22, 2011 4:51 pm

Windows assumes you're an idiot.
Linux demands proof of it.

kaizer
Level 2
Level 2
Posts: 80
Joined: Wed Feb 16, 2011 8:49 am

Re: help for simple script

Postby kaizer » Mon Jul 25, 2011 2:14 am

Thank you guys I gonna try this ....


Return to “Scripts & Bash”

Who is online

Users browsing this forum: No registered users and 2 guests