Coder Social home page Coder Social logo

filenclouddienste / filen-cli Goto Github PK

View Code? Open in Web Editor NEW
37.0 2.0 1.0 684 KB

Filen CLI for Windows, macOS and Linux

Home Page: https://filen.io

License: GNU Affero General Public License v3.0

Batchfile 0.20% TypeScript 95.18% JavaScript 4.12% Dockerfile 0.50%
cli filen headless linux mac macos s3 server webdav windows

filen-cli's Introduction

Filen CLI

Contributors Forks Stargazers Issues License

Important

The CLI is still work in progress. DO NOT USE IN PRODUCTION YET. It is not guaranteed to be stable.

The Filen CLI provides a set of useful tools for interacting with the cloud:

Installation

You can download the latest binaries from the release page. Docker images are also available as filen/cli.

Usage

$ filen [options...]

Options:

  • --help, -h: display usage information
  • --verbose, -v: display additional information
  • --quiet, -q: hide things like progress bars and additional logs
  • --email <email> and --password <password> (optionally --two-factor-code <code>, -c <code>): specify credentials
  • --log-file <file>: write logs to a file

Authenticating

There are several ways to authenticate:

  • Invoke the CLI and specify your Filen email and password. You can then choose to save them in a local encrypted configuration file. You can delete them later using filen delete-credentials.
  • Invoke the CLI with the --email and --password (optionally --two-factor-code) arguments set.
  • Put your credentials in the FILEN_EMAIL and FILEN_PASSWORD (optionally FILEN_2FA_CODE) environment variables.
  • Store your Filen email and password in a file named .filen-cli-credentials where you invoke the CLI. Put your email and password in separate lines, in plain text (optionally 2FA code in third line).

If you have 2FA enabled and don't specify a 2FA code, you will be prompted for it.

Access your Filen Drive

$ filen [options...] <cmd...>

Options:

  • --root <path>, -r <path: execute a stateless command from a different working directory
  • --json: format output as JSON
  • --no-autocomplete: disable autocompletion (for performance or bandwidth reasons)

Available commands

Many common Unix-style commands are available:

  • ls <path to directory>: list items inside a directory (pass -l for more detailed output)
  • cat <path to file>: print content of a text file
  • head <path to file> / tail <path to file>: print first / last 10 lines of a text file (pass -n 3 for only 3 lines etc.)
  • mkdir <path to directory>: create a directory
  • rm <path>: delete a file or directory (--no-trash to delete permanently)
  • stat <path>: display information about a file or directory
  • statfs: display information about your Filen cloud drive
  • whoami: print the current user
  • mv <from> <to> / cp <from> <to>: move or copy a file to a path (parent directory or file)

There are also non-standard commands specific to Filen:

  • download <cloud path> <local destination>: download a file or directory from the cloud into a local destination
  • upload <local file> <cloud path>: upload a local file into the cloud at a specified path
  • write <file> <content...>: write text to a file
  • open <file>: open a file locally in the associated application
  • edit <file>: edit a file locally in the associated application (save and close to re-upload)
  • view <path>: view a directory in the Web Drive (you can also invoke filen drive to quickly open the Web Drive)
  • favorites / recents: display favorites or recents
  • favorite <path> / unfavorite <path>: favorite or unfavorite a file or directory

Interactive mode

Invoke the Filen CLI without any specified commands to enter interactive mode. There you can specify paths as absolute (starting with /) or relative to the current working directory (supports . and ..).

Additional available commands:

  • help: display available commands
  • cd <path>: navigate to a different path
  • ls: list items inside current directory
  • exit: exit interactive mode

Trash

  • filen trash: view trash items
  • filen trash restore: restore a trash item
  • filen trash delete: permanently delete a trash item
  • filen trash empty: permanently delete all trash items

Public Links

  • filen links: view all public links
  • filen links <path>: create, view, edit or delete a public link for the given path

Syncing

$ filen sync [sync pairs...] [--continuous]

Invoke filen sync to sync any locations with your Filen Drive. This is the same functionality you get with the Desktop app.

You must specify the sync pairs ([sync pairs...] above) as follows:

  • (central registry) filen sync: Read the sync pairs from $APP_DATA/filen_cli/syncPairs.json. This file must contain JSON of the type {local: string, remote: string, syncMode: string, alias?: string, disableLocalTrash?: boolean, ignore?: string[]}[]. syncMode can be twoWay, localToCloud, localBackup, cloudToLocal or cloudBackup (see the FAQ here on what that means).
  • (custom registry) filen sync <file>: Read the sync pairs from a custom JSON file (same type as above).
  • (aliases) filen sync mypair myotherpair: Sync the sync pairs from the central registry that were given the aliases mypair and myotherpair.
  • (literal pair) filen sync /local/path:twoWay:/cloud/path: Sync the local path /local/path with the cloud path /cloud/path in two-way sync.
  • (shorthand for two-way pairs) filen sync /local:/cloud: Sync /local with /cloud in two-way sync.
  • (other sync modes and abbreviations) filen sync /local1:localToCloud:/cloud1 /local2:ltc:/cloud2: Sync /local1 with /cloud1 (and /local2 with /cloud2) in local-to-cloud sync (other abbreviations are tw = twoWay, ltc = localToCloud, lb = localBackup, ctl = cloudToLocal, cb = cloudBackup).
  • (disable local trash) filen sync /local:/cloud --disable-local-trash: Disable local trash

You can set the --continuous flag to keep syncing (instead of only syncing once).

Network drive mounting

$ filen mount [mount point]

Invoke filen mount to mount a network drive that mirrors your Filen Drive. The default mount point is X: (Windows) / /tmp/filen (UNIX).

On Windows, WinFSP needs to be installed. On Linux, FUSE 3 needs to be installed.

For more information, see also FilenCloudDienste/filen-network-drive.

WebDAV server

You can use the Filen CLI to start a WebDAV server that acts as a mirror server of your Filen Drive.

For more information, see also FilenCloudDienste/filen-webdav.

Single user

$ filen webdav --w-user <...> --w-password <...> [options...]

Invoke filen webdav to start a local WebDAV server that mirrors your personal Filen Drive. This might be useful for allowing local applications to access your Filen Drive via WebDAV.

You must specify login credentials for connecting to the server using the --w-user and --w-password options (these credentials should be different from your Filen account credentials).

Options:

  • --w-https: run the server on HTTPS instead of HTTP (using a self-signed certificate)
  • --w-hostname: which hostname the server should be started on (default is 0.0.0.0)
  • --w-port: which port the server should be started on (default is 80 or 443)
  • --w-auth-scheme: the authentication scheme the server should use, "basic" or "digest" (default is basic)
  • --threads: enables clustering, number of threads to use for the server (default is no clustering; explicitly set to 0 to set by CPU core count)

Proxy mode

$ filen webdav-proxy [options...]

Invoke the filen webdav-proxy to start a WebDAV server that allows any user to connect using their Filen account credentials and access their own Filen Drive. This might be useful when hosting a proxy server for multiple users. Digest auth is not available for proxy mode.

Important: In proxy mode, the password has to be formatted as password=yoursecretpassword&twoFactorAuthentication=<RECOVERY_CODE_OR_6_DIGIT_OTP_CODE> (you can also leave out the &twoFactorAuthentication=... part if 2FA is disabled for your account).

Options: --w-https, --w-hostname, --w-port, --threads as above

S3 server

$ filen s3 --s3-access-key-id <...> --s3-secret-access-key <...> [options...]

Invoke filen s3 to start an S3 server that acts as a mirror server of your Filen Drive. You must specify credentials (Access Key ID and Secret Access Key) for connecting to the server using the --s3-access-key-id and --s3-secret-access-key options (these credentials should be different from your Filen account credentials).

Important: When connecting to the S3 server, you need to enable s3ForcePathStyle and set the region to filen.

For more information, including on S3 compatibility, see also FilenCloudDienste/filen-s3.

Options:

  • --s3-https: run the server on HTTPS instead of HTTP (using a self-signed certificate)
  • --s3-hostname: which hostname the server should be started on (default is 0.0.0.0)
  • --s3-port: which port the server should be started on (default is 80 or 443)
  • --threads: enables clustering, number of threads to use for the server (default is no clustering; explicitly set to 0 to set by CPU core count)

filen-cli's People

Contributors

jupiterpi avatar dependabot[bot] avatar dwynr avatar

Stargazers

 avatar  avatar  avatar  avatar Govind Singh avatar  avatar  avatar Mr. Nobody avatar 旋律旋律你在干什么 avatar Kvar Izunia avatar  avatar Eirik Rolland Enger avatar Loan Jouhannet avatar Thomas Soteros avatar Roy Takanen avatar  avatar Jack Chatelain avatar zft9xgy avatar Juan Cruz Viotti avatar DaKong avatar Duzitug avatar  avatar Martin Simon avatar Riccardo Boero avatar Nikita Meshchaninov avatar Waldemar Dell avatar Dylan Ullrich avatar Enrique avatar Maurice Huber avatar  avatar  avatar  avatar Ethan Priest avatar  avatar  avatar  avatar Ashutosh Saboo avatar

Watchers

 avatar  avatar

Forkers

jupiterpi

filen-cli's Issues

Inotify watch limit reached during sync operation

When using filen-cli to sync files, the following error occurs:

filen-cli sync /local:lb:/cloud --continuous
Syncing /local to /cloud (localBackup)...
node:internal/process/promises:288
           triggerUncaughtException(err, true /* fromPromise */);
           ^
[Error: inotify_add_watch on '/a-local-dir' failed: No space left on device]
Node.js v18.19.1

This error suggests that the system has reached its limit for inotify watches, not that it has run out of disk space.

Environment

  • Operating System: Debian 12 Bookworm
  • Node.js version: v18.19.1
  • filen-cli version: v0.0.8

Proposed Solution

Consider implementing one of the following solutions in filen-cli:

  1. Automatically increase the inotify watch limit if possible.
  2. Provide a clear error message suggesting how to increase the limit.
  3. Implement a fallback mechanism that doesn't rely on inotify when the limit is reached.

As a temporary workaround, users can increase the inotify watch limit by running:

sudo sysctl fs.inotify.max_user_watches=524288

To make this change permanent, add the following line to /etc/sysctl.conf:

fs.inotify.max_user_watches=524288

Then run:

sudo sysctl -p

Thanks for your amazing product !

filen-cli 0.0.9

Version 0.0.9, when using the 'filen sync' command in 'localToCloud' mode, does not delete files on Filen when they are deleted locally. Version 0.0.8 performed this function correctly.

[Feature Request] Disable update check

I am using this cli in a bash file which will be automatically executed.
However, when a new version is available, the program just hangs at Update from ${currentVersion} to ${publishedVersion}? [y/N] and waiting for input.
Could you add a commandline argument like --skip-update to allow the program to skip update check?

Will Filen CLI get Auto Sync Feature?

Hi,

I noticed the Filen dekstop app has an auto sync feature to automatically upload new and changed files/folders to the Filen cloud.

Are there any plans to add similar auto sync functionality to the Filen CLI as well? Having this feature in the CLI client would be very helpful and match the desktop app capabilities.

Please let me know if auto sync is on the roadmap for the Filen CLI. I'd appreciate the ability to automatically sync local folders and files to the Filen cloud.

Thank you

Exclude folder from sync

Are you planning to add a feature in future updates that lets us skip syncing certain folders?

Conflict between desktop app and filen-cli

Hi, I already have the desktop application installed but when installing filen via brew it is not possible to install filen-cli because the app already exists.

Although I think it was not intended for this use, it is very likely that a user has installed the desktop version and also wants to try or use filen-cli.

~ » brew install filen                                                                                                                       
==> Downloading https://cdn.filen.io/desktop/release/filen_arm64.dmg
Already downloaded: /Users/****/Library/Caches/Homebrew/downloads/0a0d0bb257f7d7c15a26d0832227a625997b91696b34d742640836b52fd38f7b--filen_arm64.dmg
Warning: No checksum defined for cask 'filen', skipping verification.
==> Installing Cask filen
==> Purging files for version 2.0.24 of Cask filen
Error: It seems there is already an App at '/Applications/Filen.app'.

Docker Image Authentication

Hi,
I am trying to use the available docker image (via Portainer).
I have the following error(email/password/2fa provided via ENV variables directly in Portainer):

node:internal/errors:496

ErrorCaptureStackTrace(err);

^

Error [ERR_USE_AFTER_CLOSE]: readline was closed

at new NodeError (node:internal/errors:405:5)

at Interface.question (node:internal/readline/interface:404:13)

at Interface.question (node:readline:159:5)

at /filen-cli/filen.js:72146:36

at new Promise (<anonymous>)

at prompt (/filen-cli/filen.js:72142:14)

at Authentication.authenticate (/filen-cli/filen.js:72453:64)

at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

at async /filen-cli/filen.js:117169:7 {

code: 'ERR_USE_AFTER_CLOSE'

}

Node.js v18.20.3

[Bug] Version 0.0.9, the sync command does not delete the files.

Describe the bug
Version 0.0.9, when using the 'filen sync' command in 'localToCloud' mode, does not delete files on Filen when they are deleted locally. Version 0.0.8 performed this function correctly.

To Reproduce
Steps to reproduce the behavior:

  1. I sync the /home/ubuntu/documents folder with /documents in Filen cloud
  2. I delete the file prova1.doc from /home/ubuntu/documents
  3. Now I re-sync the /home/ubuntu/documents folder with /documents in Filen cloud
  4. The file prova1.doc was not deleted from the /documents folder in Filen cloud.
  5. The command: filen sync /home/ubuntu/filen/syncFilen.json
  6. The syncFilen.json:
  7. [
    {
    "local": "/home/ubuntu/documents/",
    "remote": "/documents",
    "syncMode": "localToCloud",
    "alias": "syncDocuments",
    "disableLocalTrash": true
    }
    ]

Expected behavior
As in version 0.0.8, files deleted locally should also be deleted in the Filen cloud.

Screenshots

System (please complete the following information):

  • 0.0.9
  • OS: Ubuntu 24.04.1 LTS
  • hardware configuration ARM, 16GB RAM

Additional context

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.