Is There a CLI Command to Find a File?
Mark (2737) 44 posts |
Is There a CLI Command to Find a File? Alternatively, is there some other method of finding a file by name? Thanks in advance. |
Chris Hall (132) 3554 posts |
If you want to use a sledgehammer, then use !Cat to save a ‘DiscCat’ file of the disc or directory of interest and then you will have a csv file which lists every leafname. You can then search using a text editor. Alternatively there is a primitive ‘Find’ function in !Cat so that you can get a tree file display with just the leafnames matching a search string like ‘Fred*’. The application !Cat is available from !Store. |
Steve Pampling (1551) 8170 posts |
I’m not sure why Chris didn’t quote the blindingly obvious Locate from Steve Fryatt. Locate does exactly what you want from a GUI as well as a few other things. |
Mark (2737) 44 posts |
Locate works very well, thank you. |
Mark (2737) 44 posts |
Except when searching within files. I searched for files containing my last name, “Wyzenbeek”, and Locate found 1663 objects. I was expecting about 4-5. Several of the objects found were directories. |
Steve Fryatt (216) 2105 posts |
Tests which aren’t applicable to an object pass by default, so if your only criteria is file contents, all applications and directories will match that. The solution is to tell Locate that you don’t want directories and applications to match, by de-selecting them on the Types tab. You might also want to have a read of the manual regarding content searches, as for speed reasons you’re best off specifying some other criteria as well as the contents that you’re interested in, to limit the number of possible files to search through – if there’s a suitable feature to filter on, of course (such as knowing that you only need to search text files, or something). |
Mark (2737) 44 posts |
Un-ticking directories and applications worked. Thanks for your quick response. |