How to Search for Files using FileZilla Command Line / FileZilla Pro Command Line

If you need to find a particular file on the local machine or remote server, use the command lsearch for local search, and search for remote search.

The criteria conditions for the search are specified with the --condition (or -c) option.

The --condition option takes an argument in the form:

type condition value

Note that the arguments should be enclosed in quotation marks.

Here is a breakdown of the available types:

name: apply the condition to the name of the file, including its extension (see Case sensitivity.)
size: apply the condition to the file size
perm: apply the condition to the file attributes
date: apply the condition to the date on which the file was created or last modified

Name

For type name, the value is a string and the condition can be set to:

has: whether the name of a file includes the text.

hasnot: whether the name of a file does not include the text.

=: whether the name of a file exactly matches the text.

begins: whether the name of a file starts with the text.

ends: whether the name of a file ends with the text.

rx
: if the name of a file matches a regular expression.

If the value contains spaces, enclose it with escaped quotation marks.

By default, the match is not case-sensitive. See Case sensitivity.

Permission

For type perm, the condition can be set to:

    set: search files which specified attributes are set.
    !set: search files which specified attributes are not set.

and the value is a string representing the file attributes in the format rwxrwxrwx, where

    r: the attribute allows reading.
    w: the attribute allows writing.
    x: the attribute allows executing.

Each triplet rwx in the value string represents user, group, and all access.

Date

For type date, the condition can be set to:

    >: search files created or modified after the specified date.
    =: search files created or modified on the specified date.
    !=: search files whose create or last modified date is not the specified one.
    <: search files created or modified before the specified date.

The value is a string representing a timestamp in the format YYYYMMDD[HHMMSS].

Multiple conditions

You can use multiple --condition options to provide several conditions.

The --match option takes an argument to specify how the multiple conditions are handled. It takes one argument that can be:

    all: search files matching all the conditions (the default)
    notall: search files that don’t meet the criteria for one or more conditions
    none: search files that don’t meet the criteria for all conditions
    any: search files that meet criteria for any condition

Case sensitivity

The name condition is not case-sensitive. That is, the criteria matches entries regardless of their case. To force a case-sensitive match, use the --case option.

Examples

Note: while the examples below use the lsearch command, the same applies to the search command.

Search whose name begins with DESC, desc, and so on:

    lsearch --condition "name begins DESC"

Search all files whose name begins with DESC only (case-sensitive):

    lsearch --condition "name begins DESC" --case

Search all files that match the regular expression .*2023\..* (note how \ is escaped twice, see Escape Sequences):

    lsearch --condition "name rx \".*2023\\\\..*\""

Search all files whose size is greater than 20000:

    lsearch --condition "size > 20000"

Search all files whose creation or last modified date is after December 31st, 2023:

    lsearch --condition "date > 20231231"

Search all files whose permission is set as executable for user, group, and all:

    lsearch --condition "perm set -x-x-x"

Search all files whose creation or last modified date is before March 1st, 2023, and ending with bak:

    lsearch --condition "date < 20230301" --condition "name ends bak"

Search all files whose creation or last modified date is before March 1st, 2023, or all files ending with bak:

    lsearch --condition "date < 20230301" --condition "name ends bak" --match any

Exclude from search files whose creation or last modified date is before March 1st, 2023, and whose name ends with bak:

    lsearch --condition "date < 20230301" --condition "name ends bak" --match notall

Exclude from search files whose creation or last modified date is before March 1st, 2023, or files whose name ends with bak:

    lsearch --condition "date < 20230301" --condition "name ends bak" --match none

Tags: , ,