LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Blogs > GlennsPref
User Name
Password

Notices



Rate this Entry

How to recover lost mp3's for free-p4 of 8.

Posted 05-12-2010 at 12:18 AM by GlennsPref

Code:
The xargs manpage reveals more on how the find command works....
man xargs excerpt... 
Code:
EXAMPLES 
       find /tmp -name core -type f -print | xargs /bin/rm -f 

       Find files named core in or below the directory /tmp and delete them.   Note  that  this  will 
       work incorrectly if there are any filenames containing newlines or spaces. 

       find /tmp -name core -type f -print0 | xargs -0 /bin/rm -f 

       Find  files named core in or below the directory /tmp and delete them, processing filenames in 
       such a way that file or directory names containing spaces or newlines are correctly handled. 

       find /tmp -depth -name core -type f -delete 

       Find files named core in or below the directory /tmp and delete  them,  but  more  efficiently 
       than  in  the previous example (because we avoid the need to use fork(2) and exec(2) to launch 
       rm and we don't need the extra xargs process).
	[-i[replace-str]] Replace string
Because of type setting and formatting of text I tried to use a back-slash (\) here to continue code lines, It's not very effective in the my zshell, bash may be different. You may need to copy the lines to a text editor like kate to edit/join them up, just one space is enough, and no spaces at the end. ;-)
Code:
find /home/glenn/storage/recovery/ -name "*.mp3" | xargs -i mv {} /home/glenn/storage/recovery/mp3/
find /home/glenn/storage/recovery/ -name "*.ogg" | xargs -i mv {}  /home/glenn/storage/recovery/mp3/
find /home/glenn/storage/recovery/ -name "*.wav" | xargs -i mv {}  /home/glenn/storage/recovery/mp3/
This code moves files from the mp3 directory that are less than 2048kb (2Mb) Most 2.5 to 3 minute mp3s are about +2.5Mb minimum file size...
Code:
find /home/glenn/storage/recovery/mp3/ -name "*.mp3" -size -2048k | xargs -i mv {} /home/glenn/storage/recovery/small/
find /home/glenn/storage/recovery/mp3/ -name "*.ogg" -size -2048k | xargs -i mv {} /home/glenn/storage/recovery/small/
find /home/glenn/storage/recovery/mp3/ -name "*.wav" -size -2048k | xargs -i mv {} /home/glenn/storage/recovery/small/
Now, we have sorted the files we want to work with from the files we don't want to bother with.
Posted in Uncategorized
Views 204 Comments 0
« Prev     Main     Next »
Total Comments 0

Comments

 

  



All times are GMT -5. The time now is 06:44 AM.

Main Menu
Advertisement

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration