====== File Options ======
The global configuration settings for file transfers are set in [[util:SCFG]]->File Options.

  ╔════════════════════════════════════════════════════════════════════════╗
  ║                             File Options                               ║
  ╠════════════════════════════════════════════════════════════════════════╣
  ║ │Minimum Free Disk Space          1G bytes                             ║
  ║ │Max Files in Batch UL Queue      25                                   ║
  ║ │Max Files in Batch DL Queue      100                                  ║
  ║ │Max Users in User Transfers      5                                    ║
  ║ │Default Credit on Upload         100%                                 ║
  ║ │Default Credit on Download       90%                                  ║
  ║ │Leech Protocol Detection         <disabled>                           ║
  ║ │Allowed Filename Length          64 characters                        ║
  ║ │Allowed Filename Characters      Most ASCII, Including Spaces         ║
  ║ │Supported Archive Formats        zip, 7z, tgz                         ║
  ║ │Viewable Files...                                                     ║
  ║ │Testable Files...                                                     ║
  ║ │Download Events...                                                    ║
  ║ │Extractable Files...                                                  ║
  ║ │Compressible Files...                                                 ║
  ║ │Transfer Protocols...                                                 ║
  ╚════════════════════════════════════════════════════════════════════════╝

^ Option Name                    ^ Description ^
| Minimum Free Disk Space        | Minimum free space in a file directory required to allow user uploads (e.g. ''1G'', ''100M''). |
| Max Files in Batch UL Queue    | Maximum number of files that can be placed in the batch upload queue. |
| Max Files in Batch DL Queue    | Maximum number of files that can be placed in the batch download queue. |
| Max Users in User Transfers    | Maximum number of destination users in user-to-user file uploads. |
| Default Credit on Upload       | Default percentage of credits given to uploaders, used as the default for newly created file directories. |
| Default Credit on Download     | Default percentage of credits given to the original uploader when their file is downloaded by another user, used as the default for newly created file directories. |
| Leech Protocol Detection       | If enabled, determines sensitivity to counting/logging potential leech downloads (see [[#leech_protocol_detection|below]]). |
| Allowed Filename Length        | Maximum uploaded filename length allowed (in characters). \\ \\ Only 64 characters of filenames are indexed (searchable) and sometimes (depending on the terminal) only 64 or fewer characters of a filename may be displayed to a user. For these reasons, 64 characters is a reasonable maximum filename length to enforce (and thus, the default). \\ \\ The absolute maximum filename length supported is 65535 characters. |
| Allowed Filename Characters    | Allowed Characters in Uploaded Filenames: \\ - Safest Subset Only (A-Z, a-z, 0-9, -, _, and .) \\ - Most ASCII Characters, Excluding Spaces \\ - Most ASCII Characters, Including Spaces \\ - Most CP437 Characters, Excluding Spaces \\ - Most CP437 Characters, Including Spaces |
| Supported Archive Formats      | List of archive file types (extensions/suffixes, without the leading ''.'') that libarchive should use when creating QWK/REP packets and temporary archives of files for users to download. \\ \\ Default: ''zip, 7z, tgz''. \\ \\ This list has no impact on the file types allowed to be uploaded into file areas, or on the ability to view, test, or extract archives of any other type. |
| Viewable Files...              | Sub-menu — see [[#viewable_file_types|Viewable File Types]]. |
| Testable Files...              | Sub-menu — see [[#testable_file_types|Testable File Types]]. |
| Download Events...             | Sub-menu — see [[#download_events|Download Events]]. |
| Extractable Files...           | Sub-menu — see [[#extractable_file_types|Extractable File Types]]. |
| Compressible Files...          | Sub-menu — see [[#compressible_file_types|Compressible File Types]]. |
| Transfer Protocols...          | Sub-menu — see [[#file_transfer_protocols|File Transfer Protocols]]. |

===== Leech Protocol Detection =====

This value is the sensitivity of the leech protocol detection feature of Synchronet. If the transfer is apparently unsuccessful, but the transfer time was at least this percentage of the estimated transfer time (based on the estimated CPS of the connection result code), then a leech protocol error is issued and the user's leech download counter is incremented. Setting this value to ''0'' disables leech protocol detection. This option also allows you to set the minimum amount of elapsed transfer time (in seconds) to be considered for a possible leech download.

Leech protocol programs are file transfer programs (usually using Zmodem technology) that attempt to "fool" the BBS into thinking the file was not successfully transferred, when in reality it was. This is accomplished by the transfer program requesting a reposition (ZRPOS) after the last successful block and then aborting (ZCAN). A file transferred in this manner will not be considered a successful transfer by Synchronet, but will be caught as a possible leech download and notify the sysop (if this option is used).

This feature is also useful for detecting the partial download of image (GIF) files. If you charge your users credits for downloads, this can be a very useful feature in detecting dishonest users. If the user accumulates a large number of leeches (as displayed in [[access:user_editor|User Edit]]) and the user never successfully downloads a file previously logged as a possible leech download, the user is probably trying to get something for nothing, though this is hard to prove without actually watching the file transfer in progress.

===== Viewable File Types =====

A list of file types (extensions) that have content information that can be **viewed** on the [[server:terminal|Terminal Server]] through the execution of an external program or script.

  ╔══════════════════════════════════════════════════╗
  ║                Viewable File Types               ║
  ╠══════════════════════════════════════════════════╣
  ║ │.zip      ?archive list %f                      ║
  ║ │.gif      ?gifinfo %f                           ║
  ║ │.txt      list %f                               ║
  ║ │                                                ║
  ╚══════════════════════════════════════════════════╝

  * File extensions are case-insensitive and may contain ''*'' / ''?'' wildcards. An extension of ''*'' matches **all** files.
  * If the same extension is listed more than once, each command line will be executed.
  * Use ''%f'' or ''%s'' on the command line for the path to the file being viewed.

==== Viewable File Type ====

  ╔══════════════════════════════════════════════════════════╗
  ║                  Viewable File Type                      ║
  ╠══════════════════════════════════════════════════════════╣
  ║ │File Extension          .zip                            ║
  ║ │Command Line            ?archive list %f                ║
  ║ │Native Executable       Yes                             ║
  ║ │Access Requirements                                     ║
  ╚══════════════════════════════════════════════════════════╝

^ Option Name           ^ Description ^
| File Extension         | Suffix to match (with leading ''.'', e.g. ''.zip''). Wildcards ''*'' / ''?'' are allowed; ''*'' alone matches all files. |
| Command Line           | The [[config:cmdline|command line]] to execute. Use ''%f'' or ''%s'' for the file's path. Standard prefixes apply (''?'' for [[dir:exec|exec]] JS, ''*'' for Baja, etc.). |
| Native Executable      | ''Yes'' for native binaries; ''No'' for DOS programs. |
| Access Requirements    | An [[access:requirements|ARS]] expression — only users matching it will see this view option for matching files. |

===== Testable File Types =====

A list of file types whose **upload** triggers a sysop-configured test command. The test must return error code ''0'' to mean "passed" — non-zero rejects the upload. Use this for virus scanning, archive integrity checks, or any sysop-side processing.

  ╔══════════════════════════════════════════════════╗
  ║                Testable File Types               ║
  ╠══════════════════════════════════════════════════╣
  ║ │.zip      ?archive test %f                      ║
  ║ │.7z       ?archive test %f                      ║
  ║ │*         ?virusscan %f                         ║
  ║ │                                                ║
  ╚══════════════════════════════════════════════════╝

  * Same matching rules as [[#viewable_file_types|Viewable File Types]]. Multiple test commands per extension are run in sequence.
  * The test command can also **modify** the upload: it may rewrite ''sbbsfile.nam'' (filename) or ''sbbsfile.des'' (description) in the [[dir:node|node directory]] before Synchronet finalizes the upload.
  * Also known as an //upload processing event//.

==== Testable File Type ====

  ╔══════════════════════════════════════════════════════════╗
  ║                   Testable File Type                     ║
  ╠══════════════════════════════════════════════════════════╣
  ║ │File Extension          .zip                            ║
  ║ │Command Line            ?archive test %f                ║
  ║ │Native Executable       Yes                             ║
  ║ │Working String          Testing archive integrity...    ║
  ║ │Access Requirements                                     ║
  ╚══════════════════════════════════════════════════════════╝

Same fields as [[#viewable_file_type|Viewable File Type]], plus:

^ Option Name      ^ Description ^
| Working String    | Optional message displayed to the user while the test command runs (e.g. //"Testing archive integrity..."//). Leave blank for silent operation. |
| Command Line      | Use ''%f'' for the path to the uploaded file, ''%s'' for the path to the ''sbbsfile.des'' file (file description). |

===== Download Events =====

A list of file types that trigger a command line **on download**. Same matching/return-code semantics as [[#testable_file_types|Testable File Types]]. Use this for download notifications, statistics tracking, or post-download archive maintenance.

  ╔══════════════════════════════════════════════════╗
  ║                 Download Events                  ║
  ╠══════════════════════════════════════════════════╣
  ║ │.zip      ?dlevent %f                           ║
  ║ │                                                ║
  ╚══════════════════════════════════════════════════╝

==== Download Event ====

  ╔══════════════════════════════════════════════════════════╗
  ║                    Download Event                        ║
  ╠══════════════════════════════════════════════════════════╣
  ║ │File Extension          .zip                            ║
  ║ │Command Line            ?dlevent %f                     ║
  ║ │Native Executable       Yes                             ║
  ║ │Working String                                          ║
  ║ │Access Requirements                                     ║
  ╚══════════════════════════════════════════════════════════╝

Same fields as [[#testable_file_type|Testable File Type]].

===== Extractable File Types =====

External extraction methods, by file type. Synchronet has built-in support for ''zip'', ''7z'', ''tar.gz'', and a few other common archive formats — these need **no** entry here. Use this section to add support for archive types Synchronet doesn't natively decompress.

  ╔══════════════════════════════════════════════════╗
  ║              Extractable File Types              ║
  ╠══════════════════════════════════════════════════╣
  ║ │.rar      unrar x %f                            ║
  ║ │.arj      unarj e %f                            ║
  ║ │                                                ║
  ╚══════════════════════════════════════════════════╝

==== Extractable File Type ====

  ╔══════════════════════════════════════════════════════════╗
  ║                  Extractable File Type                   ║
  ╠══════════════════════════════════════════════════════════╣
  ║ │File Extension          .rar                            ║
  ║ │Command Line            unrar x %f                      ║
  ║ │Native Executable       Yes                             ║
  ║ │Access Requirements                                     ║
  ╚══════════════════════════════════════════════════════════╝

Same fields as [[#viewable_file_type|Viewable File Type]].

===== Compressible File Types =====

External compression/archive methods, by file type. Like Extractable, this **extends** Synchronet's built-in support for common formats — add an entry only when sysop-supplied compression is required.

  ╔══════════════════════════════════════════════════╗
  ║              Compressible File Types             ║
  ╠══════════════════════════════════════════════════╣
  ║ │.rar      rar a %f *                            ║
  ║ │                                                ║
  ╚══════════════════════════════════════════════════╝

==== Compressible File Type ====

  ╔══════════════════════════════════════════════════════════╗
  ║                  Compressible File Type                  ║
  ╠══════════════════════════════════════════════════════════╣
  ║ │File Extension          .rar                            ║
  ║ │Command Line            rar a %f *                      ║
  ║ │Native Executable       Yes                             ║
  ║ │Access Requirements                                     ║
  ╚══════════════════════════════════════════════════════════╝

Same fields as [[#viewable_file_type|Viewable File Type]].

===== File Transfer Protocols =====

A list of file transfer protocols available to users for upload and download. Synchronet ships with built-in [[ref:zmodem|Zmodem]] (single-file and batch) and [[ref:xmodem|X/Y-modem]] support — additional or replacement protocols can be configured here.

For each protocol, you specify the command-key //mnemonic//, separate command lines for upload / download / batch upload / batch download, and a few flags. Leave a command line blank to disable that mode.

  ╔══════════════════════════════════╗
  ║      File Transfer Protocols     ║
  ╠══════════════════════════════════╣
  ║ │Z  Zmodem                       ║
  ║ │Y  Ymodem                       ║
  ║ │X  Xmodem                       ║
  ║ │                                ║
  ╚══════════════════════════════════╝

==== File Transfer Protocol ====

  ╔══════════════════════════════════════════════════════════════════════╗
  ║                       File Transfer Protocol                         ║
  ╠══════════════════════════════════════════════════════════════════════╣
  ║ │Mnemonic (Command Key)        Z                                     ║
  ║ │Protocol Name                 Zmodem                                ║
  ║ │Access Requirements                                                 ║
  ║ │Upload Command Line           *zmodemrcv                            ║
  ║ │Download Command Line         *zmodemsnd %f                         ║
  ║ │Batch Upload Command Line     *zmodemrcv                            ║
  ║ │Batch Download Command Line   *zmodemsnd @%f                        ║
  ║ │Native Executable             Yes                                   ║
  ║ │Supports DSZLOG               Yes                                   ║
  ║ │Socket I/O                    No                                    ║
  ╚══════════════════════════════════════════════════════════════════════╝

^ Option Name                  ^ Description ^
| Mnemonic (Command Key)        | The single keystroke users press at the protocol-selection prompt to pick this protocol (e.g. ''Z'' for Zmodem). Must be unique across all configured protocols. |
| Protocol Name                 | Display name shown in the protocol-selection menu. |
| Access Requirements           | An [[access:requirements|ARS]] expression — only users matching it will see this protocol as an option. |
| Upload Command Line           | [[config:cmdline|Command line]] for **single-file uploads**. Leave blank if the protocol can't upload. |
| Download Command Line         | Command line for **single-file downloads**. ''%f'' = path to the file. |
| Batch Upload Command Line     | Command line for **batch (multi-file) uploads**. Leave blank if the protocol doesn't support batch uploads. |
| Batch Download Command Line   | Command line for **batch downloads**. ''@%f'' refers to a list-file (one path per line) Synchronet writes. |
| Native Executable             | ''Yes'' for native binaries; ''No'' for DOS programs. |
| Supports DSZLOG               | If ''Yes'', the program writes a [[ref:dsz|DSZ-style log]] (''DSZLOG'' env-var) that Synchronet reads to verify completion and CPS. Most modern Zmodem implementations support this. |
| Socket I/O                    | (*nix only) If ''Yes'', the protocol communicates over the BBS's TCP socket directly rather than via stdin/stdout. Required for protocols that do their own I/O multiplexing. |

===== See Also =====
  * [[:config:|config index]]

{{tag>files}}
