====== Add Files ======
New for Synchronet v3.19, this JavaScript utility script replaces the functionality of the old [[util:ADDFILES]] program.

This script can import files into one or more filebases either using input filename/description lists (e.g. ''FILES.BBS'') or by just searching for files in the directory's storage path and using any descriptions embedded in each file's archive (e.g. ''FILE_ID.DIZ'').

If you just want to add a single file from the command-line, then you'll probably want to use ''[[postfile]].js'' instead.

===== Invoke ======
Run with [[util:JSexec]]
  jsexec addfiles -help

<file>
usage: [dir-spec] [-options] [listfile] [desc-off]

dir-spec:
  -all              Add files in all directories of all libraries (implies -auto)
  -lib=<name>     * Add files in all directories of specified library (implies -auto)
  -dir=<code>,... * Add files in multiple specified directories
   dir-code         Internal code of (one and only) directory to add files to
                  * indicates parameters that can be combined and/or specified multiple times
   Note: If no directories are specified, one will be prompted for.

options:
  -auto             Add files only to directories that have Auto-ADDFILES enabled (in SCFG)
  -from=<name>      Specify uploader's user name (may require quotes)
  -file=<name>      Specify files to add (wildcards supported, default: *)
  -ex=<filename>    Add to excluded filename list
                    (default: FILES.BBS,DESCRIPT.ION,00_INDEX.TXT,SFFILES.BBS,FILE_ID.DIZ)
  -diz              Always extract/use description in archive (e.g. FILE_ID.DIZ)
  -update           Update existing file entries (default is to skip them)
  -readd            Re-add existing file entries (so they appear as newly-uploaded
  -date[=fmt]       Include today's date in description
  -fdate[=fmt]      Include file's date in description
  -adate[=fmt]      Include newest archived file date in description
                    (fmt = optional strftime date/time format string)
  -delete           Delete list after import
  -v                Increase verbosity of output
  -debug            Enable debug output

optional listfile parameters:
   listfile         Name of listfile to import (e.g. FILES.BBS)
   desc-off         Description character-offset in listfile (e.g. 40)
</file>

==== Examples ====

* To search for files and import them in all directories:
  jsexec addfiles -all
  
* To search for a ''FILES.BBS'' list file and import them in all directories:
  jsexec addfiles -all FILES.BBS
  
* To search for a ''FILES.BBS'' list file and import them in all directories of the "main" library:
  jsexec addfiles -lib=main FILES.BBS
  
* To add files/descriptions from a ''FILES.BBS'' list (where file descriptions begin at column 40) for the //graphics// directory:
  jsexec addfiles graphics FILES.BBS 40
  
* To add files to a specific directory (//graphics//) using embedded descriptions (e.g. ''FILE_ID.DIZ'') //without// a list file:
  jsexec addfiles graphics -diz
===== See Also =====
  * [[:module:|module index]]

{{tag>jsutil files}}
