Interface with Drive file system.
DriveFS is an API which implements Unix like file system over Drive to manipulate over the content of any Drive in the network with an ability to alter it with write access.
Subcommands
Command | Description |
---|---|
dfms-client drive add | Add a file or directory to a Drive. |
dfms-client drive get | Get a file or directory from any Drive. |
dfms-client drive file | Get a file by its cid. |
dfms-client drive rm | Remove a file or directory from a Drive. |
dfms-client drive mv | Move and/or rename a file or directory in a Drive. |
dfms-client drive cp | Copy a file or directory in a Drive. |
dfms-client drive mkdir | Make directory in a Drive. |
dfms-client drive ls | List files under directory in a Drive. |
dfms-client drive stat | Show stats about a file or directory in a Drive. |
dfms-client drive flush | Upload local changes from cache to Storage Replicator Nodes of a Drive. |
dfms-client drive clear | Clear a local Drive. |
dfms-client drive add
Adds a file or directory under src
to dst
of a specific drive
. Forms a reference to new content in the Drive
and copies data to a local cache. Does not upload, thus to replicate content and reference should be followed
with flushing.
Use --recursive(r)
to add sub/directories.
Use --flush(f)
to flush after execution immediately.
Arguments
Name | Description |
---|---|
drive | Drive ID. |
src | The file to be added to Drive. |
dst | The destination in Drive of the file to be added. Defaults to root. |
Options
Name | Description |
---|---|
recursive(r) | Add directory paths recursively. |
flush(f) | Upload local changes from cache to Storage Replicator Nodes of a Drive. |
Examples
Add a file from pwd to a root directory in a Drive with the same name:
$ dfms-client drive baegbeibondkkrhxfprzwrlgxxltavqhweh2ylhu4hgo5lxjxpqbpfsw2lu add image.jpg
Add a directory from $HOME to a subdirectory in a Drive with the same name:
$ dfms-client drive baegbeibondkkrhxfprzwrlgxxltavqhweh2ylhu4hgo5lxjxpqbpfsw2lu add ~/kittens /images/ -r
NOTE:
'images' - is not created automatically and should be created before addition. The '/' right after the 'images' is required to show that a file or a directory should be put inside.Add a web file to a subdirectory in a Drive with a custom name:
$ dfms-client drive baegbeibondkkrhxfprzwrlgxxltavqhweh2ylhu4hgo5lxjxpqbpfsw2lu add http://placekitten.com/200/300 /images/kitten.jpg
Add a file from stdin to a root directory in a Drive with a custom name:
$ curl http://placekitten.com/200/300 | dfms-client drive baegbeibondkkrhxfprzwrlgxxltavqhweh2ylhu4hgo5lxjxpqbpfsw2lu add - /kitten.jpg
dfms-client drive get
Gets a referenced file or directory under src
to dst
of any drive
. If some or all requested content
is not cached locally, get
retrieves it from Storage Replicator Nodes, caches locally and saves to dst
. In the opposite case,
copies cached content from Drive to dst
.
Arguments
Name | Description |
---|---|
drive | Drive ID. |
src | The source path of the file to be gotten from Drive. |
dst | The destination path for the file to be outputted. Defaults to '/'. |
Examples
Get a file from root directory in a Drive to pwd with a same name:
$ dfms-client drive baegbeibondkkrhxfprzwrlgxxltavqhweh2ylhu4hgo5lxjxpqbpfsw2lu get image.jpg
Get a directory from sub directory in a Drive to $HOME with a custom name:
$ dfms-client drive baegbeibondkkrhxfprzwrlgxxltavqhweh2ylhu4hgo5lxjxpqbpfsw2lu get images/kittens ~/kitten_images
dfms-client drive file
File gets a referenced file or directory by it'd cid
to dst
of any drive
. If some or all requested content is not cached locally, drive file
retrieves it from replicators, caches locally and saves to dst
. In the opposite case, copies cached content from Drive to dst
.
dst
takes absolute path but if prefixed with '~' or '.', it is extended with home directory or pwd, respectively.
Arguments
Name | Description |
---|---|
drive | Drive ID. |
cid | The source cid of the file to be gotten from Drive. |
dst | The destination path for the file to be outputted. Defaults to '/'. |
Examples
Get a file from a Drive to pwd with a same name:
$ dfms-client drive baegbeibondkkrhxfprzwrlgxxltavqhweh2ylhu4hgo5lxjxpqbpfsw2lu file bafybeihnpekq72dk75zpkhlgoh6lsjlxcygu4vrtclaqartyxqqqys5c7m ./image.jpg
dfms-client drive rm
Removes a file or directory under path
from a specific drive
. Cleans the reference locally along with cached data.
Should be forward with flushing to upload reference changes.
Use --flush(f)
to flush after execution immediately.
Arguments
Name | Description |
---|---|
drive | Drive ID. |
path | The path of the file in a Drive to be removed. |
Options
Name | Description |
---|---|
flush(f) | Upload local changes from cache to Storage Replicator Nodes of a Drive. |
Examples
Remove file reference and clean data from cache:
$ dfms-client drive baegbeibondkkrhxfprzwrlgxxltavqhweh2ylhu4hgo5lxjxpqbpfsw2lu ls image.jpg kitten.jpg $ dfms-client drive baegbeibondkkrhxfprzwrlgxxltavqhweh2ylhu4hgo5lxjxpqbpfsw2lu rm kitten.jpg $ dfms-client drive baegbeibondkkrhxfprzwrlgxxltavqhweh2ylhu4hgo5lxjxpqbpfsw2lu ls image.jpg
NOTE:
In this case file fully removed locally and could not be got.Remove directory and everything inside only from the local cache, while keeping reference.
$ dfms-client drive baegbeibondkkrhxfprzwrlgxxltavqhweh2ylhu4hgo5lxjxpqbpfsw2lu ls /images image.jpg kitten.jpg $ dfms-client drive baegbeibondkkrhxfprzwrlgxxltavqhweh2ylhu4hgo5lxjxpqbpfsw2lu rm /images -l $ dfms-client drive baegbeibondkkrhxfprzwrlgxxltavqhweh2ylhu4hgo5lxjxpqbpfsw2lu ls /images image.jpg kitten.jpg
NOTE:
Files are removed from a local cache, but they still can be accessed from Storage Replicator Nodes as if their content is stored locally.
dfms-client drive mv
Move and/or rename a file or directory under src
to dst
in a specific drive
. Should be forward with flushing to upload reference changes.
Use --flush(f)
to flush after execution immediately.
Arguments
Name | Description |
---|---|
drive | Drive ID. |
src | The source path of the file to be moved/renamed. |
dst | The destination path of the file to be moved/renamed. |
Options
Name | Description |
---|---|
flush(f) | Upload local changes from cache to Storage Replicator Nodes of a Drive. |
Examples
Move file from root directory to subdirectory:
$ dfms-client drive baegbeibondkkrhxfprzwrlgxxltavqhweh2ylhu4hgo5lxjxpqbpfsw2lu ls images/ kitten.jpg $ dfms-client drive baegbeibondkkrhxfprzwrlgxxltavqhweh2ylhu4hgo5lxjxpqbpfsw2lu mv kitten.jpg images/ $ dfms-client drive baegbeibondkkrhxfprzwrlgxxltavqhweh2ylhu4hgo5lxjxpqbpfsw2lu ls images kitten.jpg
Rename directory:
$ dfms-client drive baegbeibondkkrhxfprzwrlgxxltavqhweh2ylhu4hgo5lxjxpqbpfsw2lu ls images/ $ dfms-client drive baegbeibondkkrhxfprzwrlgxxltavqhweh2ylhu4hgo5lxjxpqbpfsw2lu mv images kitten_images $ dfms-client drive baegbeibondkkrhxfprzwrlgxxltavqhweh2ylhu4hgo5lxjxpqbpfsw2lu ls kitten_images/
dfms-client drive cp
Copies a reference of a file or directory under src
to dst
in a specific drive
. Does not copy actual data
and makes it accessible from different places, like symlink. Should be forward with flushing to upload
reference changes.
Use --flush(f)
to flush after execution immediately.
Arguments
Name | Description |
---|---|
drive | Drive ID. |
src | The source path of the file to be copied. |
dst | The destination path of the file to be copied. |
Options
Name | Description |
---|---|
flush(f) | Upload local changes from cache to Storage Replicator Nodes of a Drive. |
Examples
Copy file from root directory to subdirectory with the a same name:
$ dfms-client drive baegbeibondkkrhxfprzwrlgxxltavqhweh2ylhu4hgo5lxjxpqbpfsw2lu ls images/ kitten.jpg $ dfms-client drive baegbeibondkkrhxfprzwrlgxxltavqhweh2ylhu4hgo5lxjxpqbpfsw2lu cp kitten.jpg images/ $ dfms-client drive baegbeibondkkrhxfprzwrlgxxltavqhweh2ylhu4hgo5lxjxpqbpfsw2lu ls images kitten.jpg $ dfms-client drive baegbeibondkkrhxfprzwrlgxxltavqhweh2ylhu4hgo5lxjxpqbpfsw2lu ls images/ kitten.jpg
Copy directory with a custom name:
$ dfms-client drive baegbeibondkkrhxfprzwrlgxxltavqhweh2ylhu4hgo5lxjxpqbpfsw2lu ls images/ $ dfms-client drive baegbeibondkkrhxfprzwrlgxxltavqhweh2ylhu4hgo5lxjxpqbpfsw2lu cp images kitten_images $ dfms-client drive baegbeibondkkrhxfprzwrlgxxltavqhweh2ylhu4hgo5lxjxpqbpfsw2lu ls images/ kitten_images/
dfms-client drive mkdir
Makes a directory under path
in a specific drive
. Should be forward with flushing to upload
reference changes.
Use --flush(f)
to flush after execution immediately.
Arguments
Name | Description |
---|---|
drive | Drive ID. |
path | The path to the directory to be created. |
Options
Name | Description |
---|---|
flush(f) | Upload local changes from cache to Storage Replicator Nodes of a Drive. |
Example
$ dfms-client drive baegbeibondkkrhxfprzwrlgxxltavqhweh2ylhu4hgo5lxjxpqbpfsw2lu ls
image.jpg
$ dfms-client drive baegbeibondkkrhxfprzwrlgxxltavqhweh2ylhu4hgo5lxjxpqbpfsw2lu mkdir images
$ dfms-client drive baegbeibondkkrhxfprzwrlgxxltavqhweh2ylhu4hgo5lxjxpqbpfsw2lu ls
images/
image.jpg
dfms-client drive ls
Lists content of a directory under path
in a specific drive
.
Use --verbose(v)
to show additional details.
Use --sort(s)
to sort list lexicographically.
Arguments
Name | Description |
---|---|
drive | Drive ID. |
path | The path to a directory to be listed. Defaults to '/'. |
Options
Name | Description |
---|---|
verbose(v) | Use long listing format. |
sort(s) | Sort list entries. |
dfms-client drive stat
Shows stats about a file or directory under path
in a specific drive
.
Arguments
Name | Description |
---|---|
drive | Drive ID. |
path | The path of the file to get stats about. |
dfms-client drive flush
Uploads all local reference changes with data to Storage Replicator Nodes of drive
. Require write access.
NOTE:
Flushing is not done automatically to aggregate multiple changes in the cache allowing uploading them at once and to make that behavior default. Use--flush
flag with any Drive state-changing command to upload immediately after any change.
Arguments
Name | Description |
---|---|
drive | Drive ID. |
dfms-client drive clear
Clears all file from a drive
locally to free disk space. Requires write access.
NOTE:
Flushing is not done automatically after flush
Arguments
Name | Description |
---|---|
drive | Drive ID. |