Difference between revisions of "Find"
Line 122: | Line 122: | ||
Find 68K executables: | Find 68K executables: | ||
+ | |||
+ | <pre style="color: black; background:lightgray; font-family:courier; width:60%"> | ||
"\@0\:\x00\x00\x03\xF3\c\;" | "\@0\:\x00\x00\x03\xF3\c\;" | ||
+ | </pre> | ||
Find PPC executables: | Find PPC executables: | ||
+ | |||
+ | <pre style="color: black; background:lightgray; font-family:courier; width:60%"> | ||
"\@0\:\x7F\x45\x4C\x46\c\;" | "\@0\:\x7F\x45\x4C\x46\c\;" | ||
+ | </pre> | ||
Find PNG images: | Find PNG images: | ||
+ | |||
+ | <pre style="color: black; background:lightgray; font-family:courier; width:60%"> | ||
"\@0\:\x89PNG\c\;" | "\@0\:\x89PNG\c\;" | ||
+ | </pre> | ||
Find IFF ILBM images: | Find IFF ILBM images: | ||
+ | |||
+ | <pre style="color: black; background:lightgray; font-family:courier; width:60%"> | ||
"\@0\:FORM\c\;\@8\:ILBM\c\;" | "\@0\:FORM\c\;\@8\:ILBM\c\;" | ||
+ | </pre> | ||
Find IFF PREFS files: | Find IFF PREFS files: | ||
+ | |||
+ | <pre style="color: black; background:lightgray; font-family:courier; width:60%"> | ||
"\@0\:FORM\c\;\@8\:PREF\c\;" | "\@0\:FORM\c\;\@8\:PREF\c\;" | ||
+ | </pre> | ||
Find IFF sound files: | Find IFF sound files: | ||
+ | |||
+ | <pre style="color: black; background:lightgray; font-family:courier; width:60%"> | ||
"\@0\:FORM\c\;\@8\:8SVX\c\;" | "\@0\:FORM\c\;\@8\:8SVX\c\;" | ||
+ | </pre> | ||
Find WAV sound files: | Find WAV sound files: | ||
+ | |||
+ | <pre style="color: black; background:lightgray; font-family:courier; width:60%"> | ||
"\@0\:RIFF\c\;\@8\:WAVE\c\;" | "\@0\:RIFF\c\;\@8\:WAVE\c\;" | ||
+ | </pre> | ||
Find JPEG JFIF images: | Find JPEG JFIF images: | ||
+ | |||
+ | <pre style="color: black; background:lightgray; font-family:courier; width:60%"> | ||
"\@0\:\xFF\xD8\xFF\xE0\c\;\@6\:JFIF\x00\c\"; | "\@0\:\xFF\xD8\xFF\xE0\c\;\@6\:JFIF\x00\c\"; | ||
+ | </pre> | ||
Find in version string (case-insensitive): | Find in version string (case-insensitive): | ||
+ | |||
+ | <pre style="color: black; background:lightgray; font-family:courier; width:60%"> | ||
"\:$VER:\c\;\#0\!00,0A,0D,80-\:string to find\;" | "\:$VER:\c\;\#0\!00,0A,0D,80-\:string to find\;" | ||
+ | </pre> | ||
Find in version string (case-sensitive): | Find in version string (case-sensitive): | ||
+ | |||
+ | <pre style="color: black; background:lightgray; font-family:courier; width:60%"> | ||
"\:$VER:\c\;\#0\!00,0A,0D,80-\:string to find\c\;" | "\:$VER:\c\;\#0\!00,0A,0D,80-\:string to find\c\;" | ||
+ | </pre> | ||
+ | |||
+ | '''MAXSIZE''' <byte size> | ||
+ | Match files that are up to <byte size> in size. | ||
− | |||
Example: | Example: | ||
+ | |||
MAXSIZE 65536 : Match files up to 64 KB in size. | MAXSIZE 65536 : Match files up to 64 KB in size. | ||
− | '''MINSIZE''' <byte size> | + | '''MINSIZE''' <byte size> |
+ | |||
+ | Match files hat are at least <byte size> in size. | ||
+ | |||
Example: | Example: | ||
+ | |||
MINSIZE 2048 : Match files at least 2 KB in size. | MINSIZE 2048 : Match files at least 2 KB in size. | ||
− | '''WITHIN''' <int>m/h/d | + | '''WITHIN''' <int>m/h/d |
+ | |||
+ | Match files with a date within <int> minutes or hours or days from now. | ||
+ | |||
Examples: | Examples: | ||
+ | |||
WITHIN 120m : Match files created/modified within the last 2 hours. | WITHIN 120m : Match files created/modified within the last 2 hours. | ||
Line 175: | Line 216: | ||
− | '''BETWEEN''' <date1, date2> | + | '''BETWEEN''' <date1, date2> |
+ | |||
+ | Match files with a date between date1 and date2. | ||
+ | |||
Accepted date formats are whatever the locale default is and DOS date format (dd-mmm-yy). | Accepted date formats are whatever the locale default is and DOS date format (dd-mmm-yy). | ||
+ | |||
Examples: | Examples: | ||
+ | |||
+ | <pre style="color: black; background:lightgray; font-family:courier; width:60%"> | ||
BETWEEN 18-Dec-22,1-Feb-23 : Match files created/modified between 18 December 2022 and 1 February 2023 | BETWEEN 18-Dec-22,1-Feb-23 : Match files created/modified between 18 December 2022 and 1 February 2023 | ||
+ | </pre> | ||
+ | '''COMMENT''' <string/pattern> | ||
+ | |||
+ | Match files with a comment that matches the given string of pattern. | ||
− | |||
Examples: | Examples: | ||
+ | |||
+ | <pre style="color: black; background:lightgray; font-family:courier; width:60%"> | ||
COMMENT "written by me" : Match files with "written by me" as a comment. | COMMENT "written by me" : Match files with "written by me" as a comment. | ||
COMMENT "written by#?" : Match files with comments that start with "written by". | COMMENT "written by#?" : Match files with comments that start with "written by". | ||
+ | </pre> | ||
+ | |||
+ | '''PROT''' <hsparwed protection bits> | ||
+ | Match files with the given protection bits. | ||
+ | |||
+ | Protection bits that are prefixed with a minus '-' sign should off to have a match. | ||
− | |||
− | |||
Examples: | Examples: | ||
+ | |||
PROT pe : Match files with the 'pure' and 'execute' protection bits set. All other protection bits will be ignored. | PROT pe : Match files with the 'pure' and 'execute' protection bits set. All other protection bits will be ignored. | ||
PROT -srwed : Match files that have the 'script' bit off and 'read', 'write', 'execute' and 'delete' bits on. | PROT -srwed : Match files that have the 'script' bit off and 'read', 'write', 'execute' and 'delete' bits on. | ||
Line 198: | Line 255: | ||
− | '''CASENAME''' | + | '''CASENAME''' |
+ | |||
+ | Force name comparison with the NAME option to be case-sensitive. | ||
+ | |||
Example: | Example: | ||
+ | |||
+ | <pre style="color: black; background:lightgray; font-family:courier; width:60%"> | ||
NAME "#?.library" CASENAME | NAME "#?.library" CASENAME | ||
+ | </pre> | ||
+ | '''CASECOMMENT''' | ||
+ | Force comment comparison with the COMMENT option to be case-sensitive. | ||
− | |||
Example: | Example: | ||
+ | |||
+ | <pre style="color: black; background:lightgray; font-family:courier; width:60%"> | ||
COMMENT "#?written by#?" CASECOMMENT | COMMENT "#?written by#?" CASECOMMENT | ||
+ | </pre> | ||
+ | '''CASECONTENTS''' | ||
+ | Force string comparison with the CONTENTS option to be case-sensitive for all given search strings. | ||
− | |||
Example: | Example: | ||
+ | |||
+ | <pre style="color: black; background:lightgray; font-family:courier; width:60%"> | ||
CONTENTS "\:myFunc1\;\:myFunc2\;" CASECONTENTS : search for "myFunc1" and "myFunc2" with case sensitivity. | CONTENTS "\:myFunc1\;\:myFunc2\;" CASECONTENTS : search for "myFunc1" and "myFunc2" with case sensitivity. | ||
+ | </pre> | ||
+ | '''FOLLOWLINKS''' | ||
+ | Also enter and search soft or hard directory links. The true path of matched files will also be shown after the path of the directory link. The default behaviour is not to enter directory links. | ||
− | |||
− | |||
Example: | Example: | ||
+ | <pre style="color: black; background:lightgray; font-family:courier; width:60%"> | ||
Find FFS:hlinkdirtest NAME al#? FOLLOWLINKS | Find FFS:hlinkdirtest NAME al#? FOLLOWLINKS | ||
Line 226: | Line 298: | ||
All.small 1628 ----rwed 09/05/13 08:19 FFS:hlinkdirtest/dir1/ > FFS:hlinkdirtarget_orig/Dopus5/Images/ | All.small 1628 ----rwed 09/05/13 08:19 FFS:hlinkdirtest/dir1/ > FFS:hlinkdirtarget_orig/Dopus5/Images/ | ||
All 484 ----rwed 03/11/99 22:28 FFS:hlinkdirtest/dir1/ > FFS:hlinkdirtarget_orig/Dopus5/Images/ | All 484 ----rwed 03/11/99 22:28 FFS:hlinkdirtest/dir1/ > FFS:hlinkdirtarget_orig/Dopus5/Images/ | ||
+ | </pre> | ||
− | + | '''LFORMAT''' <formatting string> | |
− | LFORMAT <formatting string> | + | Change the default output for found files. |
− | The default formatting string is: "%-30n %7l %a %d %t %f %c" | + | |
+ | The default formatting string is: "%-30n %7l %a %d %t %f %c" | ||
Available operators are: | Available operators are: | ||
Line 251: | Line 325: | ||
− | '''NOSIZES''' | + | '''NOSIZES''' |
+ | Do not show file size of files found. Also prevents protection info from being shown. | ||
+ | |||
+ | '''NODATES''' | ||
+ | Do not show date and time of files found. Also prevents protection info from being shown. | ||
− | |||
+ | '''NOMULTI''' | ||
+ | Do not search in multi-assign directories. | ||
− | |||
+ | '''NOICONS''' | ||
+ | Do not include icon files (.info) in the results of files found. | ||
− | |||
+ | '''PLAIN''' | ||
+ | Show only a plain filename list for the results without formatting line feeds or any additional statistics. | ||
− | |||
− | |||
| | ||
Revision as of 13:42, 26 February 2023
Description
The Find command searches through files and directories to locate file(s) matching the search keyword.
Installation
The Find command file is installed in the SYS:C/ directory by default. |
Versions
Latest versions are 46.0 and 54.0
Use the Updater utility to upgrade to and install the latest available version. |
Command Line Usage
DIR/M,DLEVEL/N,NAME/K,CONTENTS/K,MAXSIZE/K/N,MINSIZE/K/N,WITHIN/K,BETWEEN/K,COMMENT/K,PROT/K,CASENAME/S,CASECOMMENT/S,CASECONTENTS/S,FOLLOWLINKS/S,LFORMAT/K,NOSIZES/S,NODATES/S,NOMULTI/S,NOICONS/S,PLAIN/S
DIR : Path(s) to include in the search.
DLEVEL <int> : Sets directory depth level:
0 : only root directory is searched - no directories are entered 1 : only root and directories in root are searched 2 : root + 2 directory levels are searched, and so on...
NAME <name/pattern> : Search for files that match a given name or pattern.
Example:
NAME #?.guide : Match files that have a ".guide" filename suffix.
CONTENTS <string> : Search in file contents for a given string.
For simple searches only the string to search for may be given. For more complex searches several operators can also be used inside the string to enable multi-string searches, mixing hex byte codes with strings, case-sensitive matches, setting search boundaries and other things.
Operator syntax Description Example
------------ --------
\: <string> : string to match or search for "\:simple search\;" : find string anywhere in the file
\; : search statement terminator "\:string1\;\:string2\;" : find these strings in any order
\x <hex byte value> : hex byte value inside match string "\:string to find\x0A\x00\;" : find a string terminated with 0x0A and 0x00
\c : match must be case-sensitive "\:MustMatchCase\c\;" : find this string with case-sensitivity
\> <signed decimal value> : file location to start search "\>64\:string1\;" : start searching for "string1" 64 bytes from the start
of file.
"\>-100\:string1\;" : start searching for "string1" 100 bytes from the end of file.
\< <signed decimal value> : file location to end search "\>64\<120\:string1\;" : search for "string1" from byte 64 to byte 120
of a file.
"\>-150\<-80\:string1\;" : search for "string1" starting at 150 bytes from the end and ending 80 bytes from the end of file.
\@ <signed decimal value> : match string at specific file location "\@0\:\x00\x00\x03\xF3\;" : match executable file header
"\@-64\:something\;" : match "something" 64 bytes from the end of file
\[ <signed decimal value> : match string at offset relative to "\:string1\;\[20\:string2\;" : search for "string1" and match "string2"
start of last match. 20 bytes AFTER the FIRST char of "string1". "\:string1\;\[-12\:string2\;" : search for "string1" and match "string2" 12 bytes BEFORE the FIRST char of "string1".
\] <signed decimal value> : match string at offset relative to "\:string1\;\]22\:string2\;" : search for "string1" and match "string2"
end of last match. 22 bytes AFTER the LAST char of "string1".
"\:string1\;\]-30\:string2\;" : search for "string1" and match "string2" 30 bytes BEFORE the LAST char of "string1".
\# <signed decimal value> : search for string starting at offset "\:string1\;\#48\:string2\;" : search for "string1" and then for "string2"
relative to last match. 48 bytes AFTER the LAST char of "string1".
"\:string1\;\#-60\:string2\;" : search for "string1" and then for "string2" 60 bytes BEFORE the FIRST char or "string1".
\! <hex byte value(s)> : end a search when a character with "\:$VER:\c\;\#0\!00,0A,0D, : search for "string" in a file's version
the given value(s) is found. 80-\:string\;" string. The search ends when a null (00) or Up to 8 comma-separated byte hex values line feed (0A) or carriage return (0D) can be given and also a value range or a character code over 80 hex is found. in the form: <start value>-<end value> or <start value>- or -<end value>.
Note:
Difference between "search" and "match": "Match" means to find a string at a specific file location, while "Search" means to find a string anywhere within the specified range of file data.
Examples of CONTENTS operator usage:
Find 68K executables:
"\@0\:\x00\x00\x03\xF3\c\;"
Find PPC executables:
"\@0\:\x7F\x45\x4C\x46\c\;"
Find PNG images:
"\@0\:\x89PNG\c\;"
Find IFF ILBM images:
"\@0\:FORM\c\;\@8\:ILBM\c\;"
Find IFF PREFS files:
"\@0\:FORM\c\;\@8\:PREF\c\;"
Find IFF sound files:
"\@0\:FORM\c\;\@8\:8SVX\c\;"
Find WAV sound files:
"\@0\:RIFF\c\;\@8\:WAVE\c\;"
Find JPEG JFIF images:
"\@0\:\xFF\xD8\xFF\xE0\c\;\@6\:JFIF\x00\c\";
Find in version string (case-insensitive):
"\:$VER:\c\;\#0\!00,0A,0D,80-\:string to find\;"
Find in version string (case-sensitive):
"\:$VER:\c\;\#0\!00,0A,0D,80-\:string to find\c\;"
MAXSIZE <byte size>
Match files that are up to <byte size> in size.
Example:
MAXSIZE 65536 : Match files up to 64 KB in size.
MINSIZE <byte size>
Match files hat are at least <byte size> in size.
Example:
MINSIZE 2048 : Match files at least 2 KB in size.
WITHIN <int>m/h/d
Match files with a date within <int> minutes or hours or days from now.
Examples:
WITHIN 120m : Match files created/modified within the last 2 hours.
WITHIN 36h : Match files created/modified within the last 36 hours.
WITHIN 60d : Match files created/modified within the last 2 months.
BETWEEN <date1, date2>
Match files with a date between date1 and date2.
Accepted date formats are whatever the locale default is and DOS date format (dd-mmm-yy).
Examples:
BETWEEN 18-Dec-22,1-Feb-23 : Match files created/modified between 18 December 2022 and 1 February 2023
COMMENT <string/pattern>
Match files with a comment that matches the given string of pattern.
Examples:
COMMENT "written by me" : Match files with "written by me" as a comment. COMMENT "written by#?" : Match files with comments that start with "written by".
PROT <hsparwed protection bits>
Match files with the given protection bits.
Protection bits that are prefixed with a minus '-' sign should off to have a match.
Examples:
PROT pe : Match files with the 'pure' and 'execute' protection bits set. All other protection bits will be ignored. PROT -srwed : Match files that have the 'script' bit off and 'read', 'write', 'execute' and 'delete' bits on.
CASENAME
Force name comparison with the NAME option to be case-sensitive.
Example:
NAME "#?.library" CASENAME
CASECOMMENT
Force comment comparison with the COMMENT option to be case-sensitive.
Example:
COMMENT "#?written by#?" CASECOMMENT
CASECONTENTS
Force string comparison with the CONTENTS option to be case-sensitive for all given search strings.
Example:
CONTENTS "\:myFunc1\;\:myFunc2\;" CASECONTENTS : search for "myFunc1" and "myFunc2" with case sensitivity.
FOLLOWLINKS
Also enter and search soft or hard directory links. The true path of matched files will also be shown after the path of the directory link. The default behaviour is not to enter directory links.
Example:
Find FFS:hlinkdirtest NAME al#? FOLLOWLINKS Searching in "FFS:hlinkdirtest" ... AllFramesOff 144 ----rwed 02/11/21 14:00 FFS:hlinkdirtest/ All.small 1628 ----rwed 09/05/13 08:19 FFS:hlinkdirtest/dir1/ > FFS:hlinkdirtarget_orig/Dopus5/Images/ All 484 ----rwed 03/11/99 22:28 FFS:hlinkdirtest/dir1/ > FFS:hlinkdirtarget_orig/Dopus5/Images/
LFORMAT <formatting string>
Change the default output for found files.
The default formatting string is: "%-30n %7l %a %d %t %f %c"
Available operators are: %a : protection %b : block size %c : comment %d : date %e : filename extension %f : full file path %k : disk key %l : byte size %m : filename without extension %n : filename %r : link target %t : time %v : group protection %u : owner user ID %g : group user ID
NOSIZES Do not show file size of files found. Also prevents protection info from being shown.
NODATES Do not show date and time of files found. Also prevents protection info from being shown.
NOMULTI Do not search in multi-assign directories.
NOICONS Do not include icon files (.info) in the results of files found.
PLAIN Show only a plain filename list for the results without formatting line feeds or any additional statistics.
Copyright
Copyright (C) 2022 AmigaKit Ltd. Distributed with the Enhancer Software under licence.