Advanced API File Search
You can get an overview on how to search for files/folders in a container in the Search section, but there are some cases in which you may need to perform advanced searches. For these cases, LIBSAFE Advanced provides a wide range of search options:
How Advanced File Search works
You can use the following properties for searching for files (remember that you can also search for user-defined metadata):
id: To get files/folders matching a certain file id
container_id: To get files/folders that are in a certain data container
parent: To get files that are in a certain folder (parent folder)
filename: To get files matching the file name (e.g.: mydoc.txt)
fullpath: To get files matching the full path to the file (e.g.: /myfolder/mysubfolder/mydoc.txt)
deleted: 0 or 1
size: In Bytes, to get files larger than or smaller than a certain size
type: FILE or FOLDER, to get only files or folders in your query
structure: If the file is considered structured or unstructured content
format: The PRONOM format for the file
mime: The MIME TYPE for the file
date_update: Last update datetime for the file (E.g.: "2021-06-08 11:01:00.089657")
date_create: File creation date
storage_class_id: The storage class id associated to the file. See Storage.
And you can use the following operators:
like: like in the SQL syntax, supporting the
%
character onlystarts_with: The value starts with
ends_with: The value ends with
eq: Equal
!eq: Not equal
in: Value for the file/folder is one of the provided values
not_in: Not one of the provided values
gt: Greater than
lt: Lower than
gte: Greater or equal than
lte: Lower or equal than.
You can combine them, for instance, if you would like to get all the files in the container 185 with a size larger than 702 bytes (703 and larger), you can use:
If you want to refine even more, listing only the PDF 1.5 files (fmt/19), you can use:
Examples
Finding by file extension
If you want to search by file extension, you can use the ends_with
condition. For instance:
You can achieve the same using the like
condition, for instance:
Finding files with a certain string in the file name
If you are looking for files in which its full path contains "validator", you could use:
This will find:
/validator/myfile.txt
/validator.txt
/my-validator-results/myfile.txt.
Finding files created after a certain date
If you are looking for the files created after a given date, you can use:
Finding files created before a certain date
If you are looking for the files created before a given date, you can use:
Last updated