Synchronet v3.19b-Win32 (install) has been released (Jan-2022).

You can donate to the Synchronet project using PayPal.

This is an old revision of the document!


Table of Contents

File List

New for Synchronet v3.19, this JavaScript utility script (filelist.js) replaces the functionality of the old FILELIST program.

Normally executed via JSexec, this script will generate a list of files from one or more Synchronet system's file databases (filebases) and send the list to stdout which can be redirected to a file using normal system shell methods, for example:

jsexec filelist -all > allfiles.txt

The output can be plain human-readable text or JSON:

jsexec filelist -all -json > allfiles.json

Invoke

If no command-line options are provided, this script will show all the file directory internal codes and prompt the operator to type the internal code of the file directory to list.

To display the usage syntax, specify the '-help' option:

usage: [-options] [dir-code [...]] [include-filespec=*]
options:
  -all            list files in all libraries/directories
  -lib=<name>     list files in all directories of specified library
  -ex=<filespec>  add filename or spec to excluded filename list
  -hdr            include header for each directory
  -sort[=prop]    enable/configure file sorting
  -i              perform case-insensitive global sorting
  -reverse        reverse the sort order
  -json[=spaces]  use JSON formatted output
  -new=<days>     include new files uploaded in past <days>
  -p=[list]       specify comma-separated list of property names to print
  -ext            include extended file descriptions
  -ext=<prefix>   specify extended file description prefix
  -fmt=<fmt>      specify output format string (printf syntax)
  -date=<fmt>     specify date/time display format (strftime syntax)
  -size=<fmt>     specify size/byte display format (0-12)
  -name=<len>     specify filename length
  -pad            pad filename with spaces
  -v              increase verbosity (detail) of output

Scope

To list the files in a single directory, specify that directory's internal code on the command-line or type it when prompted.

To list the files in multiple directories, either:

  1. Specify each directory's internal code on the command-line
  2. Specify the parent Library short name with the -lib=<name> option on the command-line (case-sensitive)
  3. Specify the -all option to include all directories of all libraries

To include only files matching a particularly file naming pattern, specify that file pattern on the command-line (you may need to include the pattern in quotes).

To exclude files matching one or more file naming patterns, use the -ex=<name/pattern> option one or more times to specify one or more filenames or patterns to exclude from the output list.

To include only files that were uploaded/imported within a specified number of days, use the -new=<days> option.

Sort

By default, the files are ordered in their natural index-ordering (the order in which they were upload/imported - for each directory).

When the -sort option is specified on the command-line, the SCFG-configured sort order will be applied to each listed directory's files.

╔═════════════════════════════════════╗
║       Sort Value and Direction      ║
╠═════════════════════════════════════╣
║ │Name Ascending (case-insensitive)  ║
║ │Name Descending (case-insensitive) ║
║ │Date Ascending                     ║
║ │Date Descending                    ║
║ │Name Ascending (case-sensitive)    ║
║ │Name Descending (case-sensitive)   ║
╚═════════════════════════════════════╝

When the -hdr option is not specified and the -sort option is specified, then all files will be sorted as a single (globally sorted) list, even when more than one directory's files are included in that list. In this case, the default sort property is the file name property, but that may be overridden by specifying the desired sort property name as an argument to -sort=<prop-name> option. To sort strings without considering letter case, include the -i option.

To reverse the output order of files, include the -reverse option.

Format Output

The 2 main classes of output are JSON or free-form text. To specify JSON formatted output, use the -json command-line option. Many of the other command-line options do not serve a purpose when using JSON formatted output.

JSON

The default JSON output format is pretty-printed with 4-space indentation. To control the indentation level, use -json=<spaces> where “<spaces>” is the number of spaces to use for indenting or 0 for none.

The default metadata included in the JSON formatted output is just the names of each file. To add more detail (file properties), specify one or more -v options on the command-line to increase the verbosity:

  • Default: an array of file names
  • With -v: an array of file objects including: name, size, time, crc16, crc32, md5, sha1, and dir properties.
  • With -vv: an array of file objects adding: from, desc, cost, added, last_downloaded, and times_downloaded and if defined: anon and tags.
  • With -vvv: an array of file objects adding: extdesc (extended description).
  • With -vvvv: an array of file objects with all possible properties, even those that are blank/undefined.

See Also