lftp Mirror Command Exclude Matching Files [ Regex ]

www.l‮‬autturi.com
lftp Mirror Command Exclude Matching Files [ Regex ]

The mirror command in lftp is used to synchronize a local directory with a remote directory, or vice versa. It can be used to download or upload files and directories.

To exclude certain files or directories from being synchronized, you can use the --exclude option followed by a regular expression that matches the names of the files or directories you want to exclude.

Here's an example of how to use the mirror command with the --exclude option to synchronize a local directory with a remote directory, but exclude all files that have a .tmp extension:

lftp -c "mirror --exclude '*.tmp' /local/directory/ ftp://user:password@remote.server/remote/directory/"

You can use the --exclude-glob option instead of --exclude if you want to use glob patterns (e.g. *.tmp) rather than regular expressions to match the names of the files or directories you want to exclude.

You can also use the --exclude-from option to specify a file that contains a list of regular expressions or glob patterns, one per line, that match the names of the files or directories you want to exclude.

For more information about the mirror command and other options you can use with it, you can refer to the lftp manual or use the man command to view the manual pages for lftp.

Created Time:2017-10-29 22:09:02  Author:lautturi