Contents | < Browse | Browse >
/// Amiga Tip of the Week
Note from Robert Niles:
A while back I did an article on how to find files using the LIST command.
Well, we got a reply from email@example.com showing us a BETTER way.
From: IN%"firstname.lastname@example.org" "Morsink AW"
Subj: Comments on AR1.11
Comments on: Tip of the Week, Amiga Report 1.11
Looking for files...
Hi. In Amiga Report 1.11 (Sorry, I'm a bit behind...), Robert Niles'
Tip of the Week involved using "list" to find files on a disk. I wasn't
very impressed with his tip :) as there's a much better way... SEARCH.
WB 2.04+ search, that is (version 37.3 and up).
Instead of Robert's "LIST DH0:(#?/#?AR10#?) [FILES]"
I have aliased "find" as "search  file all". To stick with Robert's
"find dh0: #?ar#?",
or, without the alias, "search dh0: #?ar#? file all"
is a lot more effective, as "search all" checks all subdirectories. With
the "list" example, you'd have to edit and reissue the command for every
level of subdirectories...
If you're not sure on which drive/partition the file(s) you are looking
for is/are located, you can just insert more devices into your command:
"find dh2: dh1: dh0: #?ar#?"
Another approach: Use a cron to periodically list all files on all drives
or partitions to a file, e.g.:
"list dh2: dh1: dh0: sys: lformat "%F%S" all >dh0:FILES.all"
("%S" will get you the name of the file, "%F" its complete path. For other
options, check the AmigaDOS Reference section in your system manual.)
Now you can alias "finda" (find all) as "search dh0:files.all  nonum" for
truely carefree system-wide file tracking :). Robert's example would become:
(The pattern matching is implicit as you're searching a file now.)
Depending on a whole lot of factors, either method may be faster :).
Oh, last but not least, I also have an alias for the old (1.3) search
functionality (searching a file for a particular instance of text):
"findc" (find contents) for "search  all nonum quiet", e.g.
"findc dh0:AmigaReport Niles"
(AmigaReport could be either a file or a directory here.)
Due to the 'quiet' option, only the names of the files in which the text
was found are displayed. However, without 'quiet', search not only displays
the complete line in which the text occurred, but also every file it is
searching... that's why I prefer 'quiet' output :).
Phew... this got to be a little longer than I intended... all I meant to say
was "Using search is more effective", but just in case you decide to edit
this for inclusion in a future issue of AR, I decided to elaborate a bit.
Have a nice... Amiga!