Moving files
Agents, and you with the bodylet command, reach the files of a machine only in the folders its owner opened. A path is always the machine's own full path: /home/ana/notes.txt on Linux, C:\Users\ana\notes.txt on Windows.
What you can do#
| To | Command | Size |
|---|---|---|
| See the folders opened to agents | bodylet files ls MACHINE | |
| List one folder | bodylet files ls MACHINE PATH | |
| Print a text file | bodylet files cat MACHINE PATH | 1 MiB at a time |
| Create or replace a small file | bodylet files write MACHINE PATH | Up to 256 KiB |
| Copy a file from your computer to a machine | bodylet files put MACHINE LOCAL PATH | Up to 1 GiB |
| Copy a file from a machine to your computer | bodylet files get MACHINE PATH [LOCAL] | Up to 1 GiB |
| Copy a file or a folder from one machine to another | bodylet files transfer SOURCE DESTINATION | Up to 8 GiB |
Every copy is checked: the file is saved only once its SHA-256 checksum is the same at both ends.
Copy between two machines#
With the command line:
bodylet files transfer build-box:/home/ana/out/app 'office-pc:C:\Users\ana\Shared\app'SOURCE and DESTINATION are MACHINE:PATH. Put quotes around a Windows path so that your shell keeps its backslashes.
- The bytes never pass through your computer. They go from one machine to the other through Bodylet, which keeps nothing. Both machines must be online.
- A folder travels whole. Its files and subfolders arrive together. Symbolic links are skipped, and the command says how many. The destination checks every name before it writes anything, so a refused folder leaves nothing behind.
- The copy is put in place only when it is right. Its SHA-256 must match the source's. If you know the checksum the file should have, add
--sha256 <checksum>to require it too. - Options.
--overwritereplaces what is at the destination.--create-parentscreates missing folders.--detachstarts the copy and returns at once.
It needs: Read files on the source machine and Write files on the destination, on the agent's token; both paths inside folders the owners opened (the destination's folder opened for writing); and Bodylet 0.8.0 or later on both machines (bodylet version on each).
When the connection is cut#
You do not need to start a copy again after a network cut.
| Copy | What happens after a cut |
|---|---|
files transfer | The copy waits. Once both machines are back, it goes on from where the destination stopped, within its time limit (one hour unless you give --timeout SECONDS) |
files put | The upload goes on from the bytes Bodylet already received |
files get | The download goes on from the last byte saved. Running the same command again after a stop also goes on where it stopped |
Ctrl-C stops the bodylet command, not a transfer: the copy goes on. Follow it with bodylet job ID --wait, or stop it with bodylet cancel ID. Do not start the same copy a second time.
Small text files#
cat and write are for notes, settings and short logs:
bodylet files cat build-box /home/ana/notes.txt
bodylet files write build-box /home/ana/todo.txt < todo.txtwrite refuses to replace a file that exists unless you add --overwrite. A file that is not text cannot be printed: use files get.
Open a folder to agents#
On the machine, its owner opens a folder, for reading or for reading and writing:
bodylet policy allow files.read ~/Shared # read
bodylet policy allow files.read ~/Shared --write # read and writeAgents reach nothing outside the folders you open, and never the files of Bodylet itself. See Folders.