LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-06-2011, 09:56 PM   #1
prunkel
LQ Newbie
 
Registered: Jan 2011
Posts: 1

Rep: Reputation: 0
Requesting guidance for batch file deletion


I am running Ubuntu currently, although I have a feeling the solution to this will apply to many distributions, hence the post in "Newbie" ... but feel free to move if this belongs elsewhere!

I recently merged iTunes libraries, and after iTunes automagically moved and re-structured my music folder, there are now duplicate copies of many songs in the root directory of each artist folder.

I would like to delete all of the files within the first level of the directory structure of the iTunes Media directory. Any song files should be located one level deeper, within each album's folder.

Is there a simple way to accomplish this at the command line? I'm not sure what direction to begin looking, so any guidance is appreciated!
 
Old 01-06-2011, 11:48 PM   #2
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,823

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
You can start by giving us an example of the file and directory tree(s) that we have to work with. Most likely it will just take find or a simple loop of some kind, but it all depends on exactly what paths and names are involved.
 
Old 01-06-2011, 11:55 PM   #3
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670
Are there only Artist's folders in the base directory of your library?

If so, you could use:
find ./ -mindepth 2 -maxdepth 2 -type f -name "*.mp3" -delete
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
detect file deletion on an operating system and trace the file history or activity? lovsis Linux - Security 2 10-19-2010 09:52 AM
File Deletion mhkhalqani Linux - General 1 10-12-2005 04:08 AM
Automatic file deletion Azhrarn Linux - Newbie 5 08-30-2005 06:01 AM
Requesting kernel config file Kami.JZ Linux - General 6 05-25-2005 05:15 PM
Batch image dimension detection and deletion macskeeball Linux - Software 1 03-17-2005 04:54 AM


All times are GMT -5. The time now is 11:12 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration