LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-31-2011, 05:17 PM   #1
xj25vm
Member
 
Registered: Jun 2008
Posts: 360

Rep: Reputation: 35
Catfish finds all files in the folder - instead of just the folder


I use catfish to search for files. If I use the "locate" back-end - it works correctly. If I use the "find" back-end, catfish will find files and folders containing the word I'm searching for in their name - but it will also list in the results every single file in the the folder which has been found. It's like it is performing a search on the full path of those files, not just their name. I've tried with "Exact match" ticked and unticked, I tried with wildcards and without - doesn't seem to make any difference.

I prefer to use it sometimes with "find" - as it finds recent files which have not been indexed yet.

I'm using catfish 0.3.2.

Any suggestions as to what might I be doing wrong? All reviews and articles online about catfish mention nothing about this behaviour.
 
Old 11-01-2011, 04:38 AM   #2
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,577
Blog Entries: 31

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
Same behaviour here. From the catfish source (catfish.py):
Code:
512         methods = {
513             'find': (method, '', '%s "' + folder + '" -ignore_readdir_race -noleaf',
514                 '-wholename', '-iwholename', '', 1, 1, 0, 0, 0),
So it is behaving as programmed, if not as you would like or intuitively expect.

catfish --help output does not list any options to change the behaviour and I found no reference to modifying behaviour via a configuration file or environment variables so the only option is to change the source and recompile to .pyc.
 
Old 11-01-2011, 05:15 AM   #3
xj25vm
Member
 
Registered: Jun 2008
Posts: 360

Original Poster
Rep: Reputation: 35
Thanks for that. I've sent an email to the developer - maybe he decides to add an option in the interface to switch this on or off.

In the meanwhile, I suppose the only option for me is to disable this in the source code.
 
Old 11-01-2011, 06:06 AM   #4
xj25vm
Member
 
Registered: Jun 2008
Posts: 360

Original Poster
Rep: Reputation: 35
Just one more question - any ideas how to modify the code above to remove the "wholename" and "iwholename" options? I've tried removing them (and just leaving empty '' instead) and catfish compiles - but when trying to search with find, it complains of wrong arguments. Do I need to remove anything else in that piece of code, or get rid of the single quotes as well?

Thanks
 
Old 11-01-2011, 12:40 PM   #5
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,577
Blog Entries: 31

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
Sorry, I don't python and a quick squizz at the code got me confuzzled.
 
Old 11-10-2011, 03:42 PM   #6
NightSky
Member
 
Registered: Sep 2001
Location: Texas :(
Distribution: Slackware64-14.1
Posts: 874

Rep: Reputation: 51
Smile

Don't python here either; But looked up PyGtk2 using pkgtool and then googled it, as it is a dependency, as is Glade2. Found this for PyGtk2: http://www.pygtk.org/pygtk2tutorial/...roduction.html
Wonder if it is a path issue?
Found this for Glade2: http://glade.gnome.org/
In any case learning python & Xml is way off task for search functionality, i finally know how to do manually. Got bigger fish nipping me. Simple is really a relative term in this forum
 
Old 11-10-2011, 05:03 PM   #7
xj25vm
Member
 
Registered: Jun 2008
Posts: 360

Original Poster
Rep: Reputation: 35
A friend of mine had a look at the code, and came up with this patch for the catfish.py file (after the obligatory pre-payment beer :-) ):

Code:
--- catfish.py.old	2011-11-02 21:00:24.715160753 +0000
+++ catfish.py	2011-11-02 20:59:25.790053055 +0000
@@ -511,7 +511,7 @@
         method_name = [method, 'locate'][method=='slocate']
         methods = {
             'find': (method, '', '%s "' + folder + '" -ignore_readdir_race -noleaf',
-                '-wholename', '-iwholename', '', 1, 1, 0, 0, 0),
+                '-name', '-iname', '', 1, 1, 0, 0, 0),
             'locate': (method, '', '%s', '', '-i', '-n %i' % limit,
                 1, 0, 1, 0, 0),
             'tracker': ('tracker-search', 'trackerd', '%s', '', '', '-l %i' % limit,
It essentially replaces "-wholename" and "-iwholename" with "-name" and "-iname" arguments. It works just fine after this change. Not really sure why both arguments are needed - "-iname" would have done just fine - but I kept it as close to the original as possible.

I've sent the patch to the author - but had no reply. Maybe he will get around to it sometime. Otherwise, you can just patch it yourself.

I don't use catfish that much myself (I mainly use find on the command line) - I have few users who prefer not to learn too much Linux - just use it. I know, the idea abhors some technical people - but some people like to spend their time learning other stuff, not computers.

Last edited by xj25vm; 11-10-2011 at 05:05 PM.
 
1 members found this post helpful.
Old 11-12-2011, 02:47 AM   #8
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,577
Blog Entries: 31

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
Thanks for the fix xj25vm

In case it's useful, here is how I installed a fixed version, starting with the source tarball from the catfish home page.
Code:
cp catfish-0.3.2.tar.gz /tmp \
    && cd /tmp \
    && tar xzvf catfish-0.3.2.tar.gz \
    && cd catfish-0.3.2 \
    && ./configure --prefix=/usr \
    && sed -i 's/wholename/name/g' catfish.py \
    && make install

Last edited by catkin; 11-12-2011 at 02:48 AM. Reason: alignment
 
Old 11-12-2011, 02:58 PM   #9
xj25vm
Member
 
Registered: Jun 2008
Posts: 360

Original Poster
Rep: Reputation: 35
Excellent work. Didn't test your version - but hope it all works just the same. It might come in handy for somebody else looking for a fix. Thanks for posting
 
  


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
[SOLVED] How to list folder size, and number of files and folders in folder steven.c.banks Linux - General 3 11-24-2010 07:24 AM
keep chmod on folder, sub-folder and files Friis Linux - Newbie 2 11-03-2010 11:55 AM
i need to copy files from one folder to another folder using shell anurupr Linux - Newbie 17 03-04-2010 10:07 AM
How to automatically move files from one folder into another folder? xmrkite Linux - Software 6 11-05-2006 11:39 AM
IglooFTP-PRO refuses to upload files in folder when I upload folder eBopBob Linux - Software 0 08-27-2004 06:52 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:06 PM.

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