help for simple script

About writing shell scripts and making the most of your shell
Forum rules
Topics in this forum are automatically closed 6 months after creation.
Locked
kaizer

help for simple script

Post by kaizer »

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
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
richyrich

Re: help for simple script

Post by richyrich »

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

Re: help for simple script

Post by steev »

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
Habitual

Re: help for simple script

Post by Habitual »

kaizer

Re: help for simple script

Post by kaizer »

Thank you guys I gonna try this ....
Locked

Return to “Scripts & Bash”