Skip to main content

Uploading Files and Folders

The CLI App uploads files and folders to your Files.com site. The destination can be any folder on your site, including folders inside Remote Server Mounts.

To upload a single file, use the command:

files-cli upload /local/path/to/file.txt /remote/path/to/file.txt

or

files-cli upload /local/path/to/file.txt /remote/path/to/folder/

To upload a single folder, use the command:

files-cli upload /local/path/to/folder/ /remote/path/to/folder/

Using Wildcards to Upload Multiple Files or Folders

You can upload multiple files and folders by using wildcard characters to specify which files or folders to target.

To upload multiple files, use the command:

files-cli upload *.txt /remote/path/to/folder/

or

files-cli upload /path/to/*/subfolder/*.txt /remote/path/to/folder/

To upload the contents of multiple folders into a single destination folder use the command:

files-cli upload /local/path/to/*/ /remote/path/to/folder/

or

files-cli upload */ /remote/path/to/folder/

or

files-cli upload /path/to/first/folder/ /path/to/second/folder/ /path/to/third/folder/ /remote/path/to/folder/

Uploading Into Multiple Destination Folders

Wildcards cannot upload or download into multiple destination folders. When wildcards are used, the contents of the source folders merge into a single destination folder.

For example, say you have three source folders named C:\Source\FolderOne, D:\Source\FolderTwo, and E:\AnotherSource\FolderThree. You want to upload these into a folder named Destination on Files.com, ending up with Destination/FolderOne, Destination/FolderTwo, and Destination/FolderThree.

A wildcard won't produce that result, because the source folder contents merge into the destination folder.

Instead, perform a separate upload (or download) for each destination:

files-cli upload C:\Source\FolderOne Destination\FolderOne
files-cli upload D:\AnotherSource\FolderTwo Destination\FolderTwo
files-cli upload E:\YetAnotherSource\FolderThree Destination\FolderThree

Uploading to Remote Servers, Snapshots, and Child Sites

Remote Servers, Snapshots, and Child Sites hold files that sit outside your site's normal folder tree. The CLI App has a named command for each one. You give it the destination's numeric ID and a path relative to that destination's root, and the CLI builds the rest of the path for you.

Just like reaching Remote Servers, Snapshots, and Child Sites through the underscore folder, these commands are available to Site Administrators only.

Uploading to a Remote Server

A Remote Server is a connection to storage you run outside your Files.com site. Pass its ID and a path relative to the root of that server:

files-cli upload-to-remote-server /local/path/to/file.txt path/to/file.txt --remote-server-id 1234

Get the ID by running files-cli remote-servers list.

What you can write to a Remote Server depends on the credentials Files.com uses to connect to it. If those credentials only allow listing and downloading, the upload fails even for a Site Administrator.

Uploading to a Snapshot

A Snapshot captures files as they existed at one point in time, and becomes read-only once you finalize it. Pass its ID and a path relative to the root of that snapshot:

files-cli upload-to-snapshot /local/path/to/file.txt path/to/file.txt --snapshot-id 5678

Get the ID by running files-cli snapshots list.

Upload to a snapshot before you finalize it. Finalizing is what freezes the contents, and that is the whole point of a snapshot for legal holds and point-in-time copies. While a snapshot is still open, you can add files to it. Once it is finalized, you can download from it, and nothing more can be written to it.

Uploading to a Child Site

A Child Site is a separate Files.com site nested under your own. Pass its ID and a path relative to the root of that site:

files-cli upload-to-child-site /local/path/to/file.txt path/to/file.txt --site-id 9012

The CLI has no command that lists Child Sites. Get the ID from the Child Sites page in the web interface.

A Site Administrator of a Parent Site has full file access to every Child Site beneath it, which is what makes this upload work.

Uploading Multiple Files or Folders to External Destinations

Each of the above commands uploads a single file to an external destination. To upload a folder or multiple files at once to one of these destinations, use the generic upload command with the full underscore path:

files-cli upload /local/path/to/folder/ "_/RemoteServers/1234/path/to/folder/"
files-cli upload /local/path/*.txt "_/RemoteServers/1234/path/to/files/"

Viewing Connection Information

You can see the connection information, showing the number of open data connections, the number of open API connections, and the network throughput, by using the --connection-metrics flag.

files-cli upload /local/path/to/folder/ /remote/path/to/folder/ --connection-metrics