finding files on my computer
Jul. 22nd, 2024 06:33 pm![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
I am a hoarder. I keep everything... not so much in the physical world, but on my computer. I keep all the cool images I encounter, all the interesting webpages that I read, all the interesting ebooks I read and the ones I hope to read, all the cool talks and music and videos I hear and see. As a result I have terabytes of data.
I'm very careful to store all this data sensibly. Everything is named descriptively and stored in directories that form a branching tree of logical categories. All this is great when I can remember exactly where a file is stored and what it is named, but I have absurd amounts of data. If I saved a file, say, 30 years ago and I can't remember what I called it and what category I'd stored it under, that item is pretty-much lost. A few times this has happened to me and I had to turn to Google to find what the original was called, so that I could then locate it on my backup drives.
I'd often thought it would be great to have a search program like Google on my own machine. Over the years I've tried making something a bit like it. The Linux commands "grep" and "find" are useful, but they are awkward. The "find" command in particular, has a number of peculiarities that make it annoying to use.
Some decades back I wrote a very simple script, which I called "findfile", or "ff", which did most of what I needed a search program to do, but I've become dissatisfied with it. Often I need to search on multiple terms, for example "donald duck" gets right to the results I might be searching for because it would ignore all the people named Donald and all the waterfowl and actions of ducking performed by people. But my program allowed only one search term. I often got around this when absolutely necessary by piping the results into grep with it looking through the results for the second word. This works, but is awkward.
Another thing I felt a great need for was being able to use regular expressions in my searches. Regular expressions can be incredibly powerful.
So, recently I completely rewrote my findfile program. It now takes any number of search terms, like Google does, but it also allows me to use regular expressions. Yay! The result is still just a small bash script, but it has made my life so much easier now. I never realised just how much I needed it.
I also rewrote my old, similar search program, that looked for text inside files. It's named, appropriately, "findtext", or "ft". It, too, can now take multiple search terms and use regular expressions.
I'm very careful to store all this data sensibly. Everything is named descriptively and stored in directories that form a branching tree of logical categories. All this is great when I can remember exactly where a file is stored and what it is named, but I have absurd amounts of data. If I saved a file, say, 30 years ago and I can't remember what I called it and what category I'd stored it under, that item is pretty-much lost. A few times this has happened to me and I had to turn to Google to find what the original was called, so that I could then locate it on my backup drives.
I'd often thought it would be great to have a search program like Google on my own machine. Over the years I've tried making something a bit like it. The Linux commands "grep" and "find" are useful, but they are awkward. The "find" command in particular, has a number of peculiarities that make it annoying to use.
Some decades back I wrote a very simple script, which I called "findfile", or "ff", which did most of what I needed a search program to do, but I've become dissatisfied with it. Often I need to search on multiple terms, for example "donald duck" gets right to the results I might be searching for because it would ignore all the people named Donald and all the waterfowl and actions of ducking performed by people. But my program allowed only one search term. I often got around this when absolutely necessary by piping the results into grep with it looking through the results for the second word. This works, but is awkward.
Another thing I felt a great need for was being able to use regular expressions in my searches. Regular expressions can be incredibly powerful.
So, recently I completely rewrote my findfile program. It now takes any number of search terms, like Google does, but it also allows me to use regular expressions. Yay! The result is still just a small bash script, but it has made my life so much easier now. I never realised just how much I needed it.
I also rewrote my old, similar search program, that looked for text inside files. It's named, appropriately, "findtext", or "ft". It, too, can now take multiple search terms and use regular expressions.