LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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 10-02-2014, 08:09 AM   #1
rmcellig
Member
 
Registered: Sep 2009
Posts: 252
Blog Entries: 1

Rep: Reputation: 24
Finding specific files quickly...


At the moment I am using Linux Lite 2.0 (Ubuntu based) on a HP laptop Pavilion dv6 with 4GB of RAM.


Here is my situation.

I host a weekly radio show. I need to quickly search for files on my external HD (radiomusic) that meet specific criteria and than copy the files I want out of the search results to another folder.

For example, if I am doing a show on songs that contain the color blue, I want to pick the songs from the resulting search list and than copy them to another folder.

I tried Catfish 1.0.2 but it doesn't seem to allow me to select the files I want from the results list and copy them to another folder. Are there any other search tools out there that will allow me to do this? What are my options.

I have thought of maybe using the CLI find command but am not sure how I would search based on what I mentioned above.

Bottom line is that I need something fast, flexible and reliable that I can use on a daily basis to put my radio shows together.
 
Old 10-02-2014, 08:14 AM   #2
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
if the name of the file has the word blue in the filename you can try[untested]:
Code:
find /whatever/floats -name "*blue*" -exec cp '{}' /your/boat \;
if it is the id3 tag information that has the word blue then some more magic would have to be coded.

for speed look into using locate. since locate creates a daily file containing locations of files (therefore it is quicker to look at 1 file rather than process a whole harddrive). however if you created a file 5 minutes ago locate wont find it until it refreshes its file listing tomorrow.

Last edited by schneidz; 10-02-2014 at 08:17 AM.
 
Old 10-02-2014, 08:29 AM   #3
rmcellig
Member
 
Registered: Sep 2009
Posts: 252

Original Poster
Blog Entries: 1

Rep: Reputation: 24
Quote:
Originally Posted by schneidz View Post
if the name of the file has the word blue in the filename you can try[untested]:
Code:
find /whatever/floats -name "*blue*" -exec cp '{}' /your/boat \;
if it is the id3 tag information that has the word blue then some more magic would have to be coded.

for speed look into using locate. since locate creates a daily file containing locations of files (therefore it is quicker to look at 1 file rather than process a whole harddrive). however if you created a file 5 minutes ago locate wont find it until it refreshes its file listing tomorrow.
So in effect I would use this code to copy all of the search results to a folder and then from whatever file manager I am using, I can select the files I want and then delete the rest?

I will try what you suggested and see how it goes. Still looking for a quick GUI option as well.

Thanks!!
 
Old 10-02-2014, 08:49 AM   #4
rmcellig
Member
 
Registered: Sep 2009
Posts: 252

Original Poster
Blog Entries: 1

Rep: Reputation: 24
The code worked!

Now what would be the correct syntax if I wanted to do a search for all .mp3 and .m4a files that contain blue, red, green, yellow, pink, orange from the same code you provided? Can I do that? This way I could search for everything I want in just one line of code!

If I can nail down this CLI way of finding the files than I would think it is faster than using a GUI tool. I can also replace the find command with the locate command and it should be faster searching?

When I first switched to Linux about three years ago, I HATED the terminal. I thought it was archaic and way too cumbersome. Slowly, I am discovering the power within the terminal and, I can't believe I'm saying this...Liking it a lot

I'd still like to know what the GUI alternatives would be as well
 
Old 10-02-2014, 09:29 AM   #5
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Quote:
Originally Posted by rmcellig View Post
The code worked!

Now what would be the correct syntax if I wanted to do a search for all .mp3 and .m4a files that contain blue, red, green, yellow, pink, orange from the same code you provided? Can I do that? This way I could search for everything I want in just one line of code!
Yes, as an example:
Code:
find /whatever/floats -name "*blue*" -o -name "*red*" -o -name "*orange*" -type f -exec echo cp '{}' /your/boat \;
If this passes the litmus test visually, remove echo

Quote:
Originally Posted by rmcellig
When I first switched to Linux about three years ago, I HATED the terminal. I thought it was archaic and way too cumbersome. Slowly, I am discovering the power within the terminal and, I can't believe I'm saying this...Liking it a lot
c-line is King.

Quote:
Originally Posted by rmcellig
I'd still like to know what the GUI alternatives would be as well
Depends on the GUI, that is why I prefer the c-line, it doesn't care about GUI.
 
Old 10-02-2014, 09:45 AM   #6
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
this way is kinda' more complicated:
Code:
[schneidz@hyper ~]$ find music/ -exec sh -c "file \"{}\" |  grep FLAC > /dev/null"  \; -printf "%p\n"
music/20-machel_montano-bottle_of_rhum.flac
music/11 - 5 O'Clock (feat. Phonte of Little Brother).flac
but i prefer it since it will use the file command to determine the filetype rather than just the filename.
for example tps-report.flac will not be returned eventhough it is mislabeled as a flac and something like truck-artist-album.ods would be returned (if it really a music file).

modified above script:
Code:
find /whatever/floats -type f -name "*blue*" -o -name "*red*" -o -name "*green*" -o -name "*pink*" -o -name "*yellow*" -name "*orange*" -exec cp '{}' /your/boat \;

Last edited by schneidz; 10-02-2014 at 10:11 AM.
 
Old 10-02-2014, 10:01 AM   #7
Beryllos
Member
 
Registered: Apr 2013
Location: Massachusetts
Distribution: Debian
Posts: 529

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
GUI alternatives

What desktop environment do you have?

I have Gnome, and its default file manager is Nautilus, which can do what you are asking. It appears in the GUI applications under the name "Files" with an icon that looks like a 2-drawer filing cabinet. In the version I have, there is a Search button near the top, and "Search for Files" is under the "Go" menu tab.

Indexing will speed up searches. Nautilus comes with an accessory application called "Search and Index" which is for setting up (customizing) the indexing of any folders you like, including those on external drives. It will search for patterns in filenames and in file contents, but for me it doesn't seem to find ID3 tags in MP3 files (not sure why).

When I search for blue, the results appear in a window from which I can pick the files I want, and drag-and-drop them to another file manager window. The default action for drag-and-drop of search results is to copy (not move). If you hold the Alt key while drag-and-dropping, it will pop up a menu to Copy, Move, or Link the file to the target folder.

If you have another desktop environment, it probably has a file manager with comparable search and file handling capabilities.
 
Old 10-02-2014, 10:13 AM   #8
Beryllos
Member
 
Registered: Apr 2013
Location: Massachusetts
Distribution: Debian
Posts: 529

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
One more thing: the Nautilus search tool doesn't care about upper or lower case. Search for blue and it will also find Blue.

In the command line, you can do a case-insensitive name search with -iname. Example:
Code:
find -iname "*blue*"

Last edited by Beryllos; 10-02-2014 at 10:17 AM.
 
Old 10-02-2014, 11:09 AM   #9
rmcellig
Member
 
Registered: Sep 2009
Posts: 252

Original Poster
Blog Entries: 1

Rep: Reputation: 24
Thanks Beryllos!

I am using Linux Lite 2.0 which uses Thunar 1.6.3. I installed Nautilus but I'm not sure if it is using up a lot of resources. It worked very well for me. Can you save search criteria so that you can use them later on? Does Nautilus support this?

What distro are you using?
 
Old 10-02-2014, 12:07 PM   #10
Beryllos
Member
 
Registered: Apr 2013
Location: Massachusetts
Distribution: Debian
Posts: 529

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
I am not familiar with Thunar... Okay, I just looked it up, and it appears that it has very limited search/find capabilities. I see that the search functionality can be enhanced by catfish, but you have already tried that.

In Nautilus, there is a way to save search criteria, but I have not completely figured out how to use it. Seems like I can save a search, but it doesn't always work when I invoke it. Could be user error.

I am using Debian 7.x (Wheezy).
 
Old 10-02-2014, 12:16 PM   #11
rmcellig
Member
 
Registered: Sep 2009
Posts: 252

Original Poster
Blog Entries: 1

Rep: Reputation: 24
So it is Debian 7 Gnome edition? I was thinking of trying this distro out. How do you like it?
 
Old 10-02-2014, 12:48 PM   #12
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
maybe you can roll your own gui by wrapping your find call into a zenity menu.
 
Old 10-02-2014, 12:55 PM   #13
Beryllos
Member
 
Registered: Apr 2013
Location: Massachusetts
Distribution: Debian
Posts: 529

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
Yes, I am running Debian 7 Gnome edition. I like it a lot. Earlier this year, I set it up on several family computers as a replacement (actually a substantial upgrade ) for Windows XP. It seems to work very well for us.

Your mileage may vary. Since you are using Linux Lite 2.0 (with xfce I guess), and you expressed concern about resources, I suspect you are working with a small memory. I can report that on my household computers, Debian with Gnome runs great with 2GB of RAM, not bad with 1 GB, but pretty slow with 512 MB. Some of that might be due to the processor and graphics card (nicer computers come with more of everything), and it depends on the applications you use.

Edit: I just noticed in your OP that you have 4 GB RAM, so you should be fine.

Last edited by Beryllos; 10-02-2014 at 02:37 PM.
 
Old 10-02-2014, 01:15 PM   #14
rmcellig
Member
 
Registered: Sep 2009
Posts: 252

Original Poster
Blog Entries: 1

Rep: Reputation: 24
I just installed Debian 7 Gnome in a separate partition on my laptop to see what it is like. The index and search option looks great. Searches should be really fast after indexing my drives. Looking forward to using it!
 
  


Reply



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
Finding specific text from a file that is within specific symbols netpumber Linux - Newbie 9 06-19-2014 03:23 PM
finding files n mins older or newer then a specific file species3618 Linux - Newbie 3 02-13-2012 10:06 AM
[SOLVED] How to quickly mark files? KonfuseKitty Linux - Software 2 07-10-2010 07:29 AM
LXer: Finding the right software code snippets quickly LXer Syndicated Linux News 0 10-18-2007 01:41 AM
Finding my posting quickly Kocil LQ Suggestions & Feedback 3 08-23-2003 04:19 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:04 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
Open Source Consulting | Domain Registration