Copyright©
Kambiz R. Khojasteh. All rights reserved.
Get future component updates from http://www.delphiarea.com.
Delphi
1 |
Delphi
3 |
Delphi
4 |
Delphi
5 |
Delphi
6 |
DESCRIPTION
TFindFile is
a non-visual component, which could be used for locating files
or folders in the file system and directory tree with an extensive set of
options. TFinFile locates files or folders by name, location, size, creation
date and time, last modification date and time, last access date and time,
or containing text. In 32bit version of TFindFile, the search process can
be done in a separated thread.
PROPERTIES
- Filename:
String
Specifies the name of the file that you want to
find. This name may contain wildcards. When IncludeFiles property is
set, TFindFile ignores this property.
- Location:
String
Determines the folder that you want to do the search there. To specify
multiple folders for search location, separate folders by semicolon. When
IncludeFiles property is set, TFindFile ignores this property.
- Subfolders:
Boolean
If set to true, all subfolders of the specified
location will be searched.
- IncludeFiles:
TStringList
Determines the list of files that you want to find.
File names can contain wildcards and should have contain drive and path. When
this property is set, TFindFile ignores Filename and Location
properties.
- ExcludeFiles:
TStringList
Determines list of files that must be ignored in the search result. Files
in this list can contain wildcards.
Example:
*.txt |
|
Ignores
all text files in any folder and drive |
C:\*.txt |
|
Ignores
all text files in root of drive C: |
?:\*.txt |
|
Ignores
all text files in root of any drive |
C:lib\*.txt |
|
Ignores
all text files in lib subfolder of any folder of drive C: |
lib\*.txt |
|
Ignores
all text files in lib subfolder of any folder of any drive |
C:\lib\*.txt |
|
Ignores
all text files in lib subfolder of root of drive C: |
?:\lib\*.txt |
|
Ignores
all text files in lib subfolder of root of any drive |
- Attributes:
TFileAttributes
TFileAttribute = (ffArchive, ffReadonly, ffHidden,
ffSystem, ffDirectory)
TFileAttributes = set of TFileAttribute
Determines desired attributes for the target file(s).
ffArchive |
|
Archive
files are acceptable |
ffReadonly |
|
Read-only
files are acceptable |
ffHidden |
|
Hidden
files are acceptable |
ffSystem |
|
System
files are acceptable |
ffDirectory |
|
Directories
are acceptable |
When Attributes property set to empty, it means normal attribute.
- ExactAttribute:
Boolean
If set to true, file will be accepted if its attributes are as same as
the attribute property.
Example:
Attributes
:= [ffReadonly, ffHidden]; |
|
ExactAttribute
:= False; |
{ TFindFile
locates for files by Read-only OR Hidden attribute bit set. } |
ExactAttribute
:= True; |
{ TFindFile
locates for files by Read-only AND Hidden attribute bit set. } |
- Containing:
String
Specifies the text that file must contain it. Set
this property to empty string if you do not need this option.
- IgnoreCase:
Boolean
If sets to true, the component ignores case of letters while searching in
the file's content for the containing text.
- SizeMin:
LongInt
Determines the lower range of the file size. Set this property to zero
if you do not need this criteria.
- SizeMax:
LongInt
Determines the upper range of the file size. Set this property to zero
if you do not need this criteria.
- CreatedAfter:
TDateTime (32bit Only)
Determines the lower range of the file creation date and time. To ignore lower
date criteria, set date part to zero and to ignore lower time criteria, set
time part to zero.
- CreatedBefore:
TDateTime (32bit Only)
Determines the upper range of the file creation date and time. To ignore upper
date criteria, set date part to zero and to ignore upper time criteria, set
time part to zero.
- ModifiedAfter:
TDateTime
Determines the lower range of the file last modified date and time. To ignore
lower date criteria, set date part to zero and to ignore lower time criteria,
set time part to zero.
- ModifiedBefore:
TDateTime
Determines the upper range of the file last modified date and time. To ignore
upper date criteria, set date part to zero and to ignore upper time criteria,
set time part to zero.
- AccessedAfter:
TDateTime (32bit Only)
Determines the lower range of the file last accessed date and time. To ignore
lower date criteria, set date part to zero and to ignore lower time criteria,
set time part to zero.
- AccessedBefore:
TDateTime (32bit Only)
Determines the upper range of the file last accessed date and time. To ignore
upper date criteria, set date part to zero and to ignore upper time criteria,
set time part to zero.
- Aborted:
Boolean (Read-only)
When is true, indicates the last search process has been aborted.
- Busy: Boolean
(Read-only)
When is true, indicates the component is searching right now.
- Threaded:
Boolean (32bit Only)
If set to true, search begins in a separated thread.
- ThreadPriority:
TThreadPriority (32bit Only)
Determines priority of the thread for threaded search.
METHODS
- procedure
Execute
begins the search process.
- procedure
Abort
Aborts the running search and sets the aborted property to true.
EVENTS
- OnFound:
TFoundEvent
TFoundEvent = procedure (Sender: TObject; Folder: String; var FileInfo:
TSearchRec) of object
This event will be fired when a file matches with the search criteria.
"Folder" specifies the location of the file and "FileInfo"
contains the file information (Name, Size, Time, Attr, and...).
- OnNewFolder:
TFoundEvent
TNewFolderEvent = procedure (Sender: TObject; Folder: String; var IgnoreFolder:
Boolean) of object
This event helps you to monitor the current search location and will
be triggered when component begins to search in a new folder. To bypass a
folder, set "IgnoreFolder" to True.
- OnComplete:
TNotifyEvent
This event is just triggered when search is completed or aborted.
HISTORY
- 2.22
(December 26, 2001)
- A bug on 16bit version fixed.
- 2.21 (April
16, 2000)
- A minor bug fixed.
- 2.20 (April
15, 2000)
- All reported bugs fixed.
- 2.11 (March
20, 2000)
- In the previous version of the component, TFindFile ignores the files with
normal attribute. In the current version the bug is fixed.
- 2.10 (March
18, 2000)
-
Two new properties IncludeFiles and ExcludeFiles added to the
component.
- 2.00 (February
25, 2000)
- ffNormal was a meaningless attribute and removed. When no any
attribute is selected, it means Normal.
- Files can be found by spcifiying the range of size, creation date and time,
last modified date and time, last accessed date and time, and containing text.
- Component improved to accept all or any of the selected attributes for the
file.
- Now, search location can contain multiple folders.
- 1.10 (February
1, 2000)
- Now the search process can be done in a separated thread (32bit Only).
- Threaded, ThreadPriority, and Busy properties and OnComplete event added.
- 1.00 (January
14, 2000)
-
Initial release.
LICENSE
TFindFile component
is freeware. You may copy component's files AS LONG AS YOU COPY ALL OF THEM.
If you want to change the source code in order to improve the component's
features, performance, etc. please send me the new source code so that I can
have a look at it. The changed source code should contain descriptions what
you have changed, and of course your name. The only thing you MAY NOT CHANGE
is the ORIGINAL COPYRIGHT INFORMATION.
DISCLAIMER
TFindFile is
provided "AS IS" without any warranty of any kind, either express
or implied. The entire risk as to the quality and performance of the software
is with you. The author is NOT liable for any DAMAGES resulting from the use
and misuse of the component, especially he is NOT liable for DAMAGES that
were caused BY ANY VERSION WHICH HAS NOT BEEN PROGRAMMED BY THE AUTHOR HIMSELF.