4 The operations of uploading files to Pithos+ as objects, and downloading
5 objects from Pithos+ as files are presented in this section.
7 Upload a file or a directory
8 ----------------------------
10 First, check the files at the current directory
12 .. code-block:: console
17 $ kamaki container list
18 pithos (36MB, 5 objects)
21 Upload `file2upload.txt` to the default container (`pithos`)
23 .. code-block:: console
25 $ kamaki file upload file2upload.txt
26 Uploading /home/someuser/file2upload.txt --> /pithos/file2upload.txt
31 .. code-block:: console
41 Attempt to upload a whole directory, fail and retry with correct arguments
43 .. code-block:: console
45 $ kamaki file upload dir2upload
46 /home/someuser/dir2upload is a directory
47 | Use -r to upload directory contents
48 $ kamaki file upload -r dir2upload
49 mkdir /pithos/dir2upload
50 Uploading /home/someuser/dir2upload/large.mov --> /pithos/dir2upload/large.mov
51 Uploading /home/someuser/dir2upload/small.mov --> /pithos/dir2upload/small.mov
55 1GB dir2upload/large.mov
56 1MB dir2upload/small.mov
64 .. note:: Try to re-upload the files (use the -f option to override) and notice
65 how much faster is the uploading now. Pithos+ can determine what parts
66 (blocks) of the file are already uploaded so that only the missing pars
69 Download an object or a directory
70 ---------------------------------
72 Download object `info.txt` as a local file of the same name
74 .. code-block:: console
76 $ kamaki file download info.txt
77 Downloading /pithos/info.txt --> /home/someuser/info.txt
80 Download directory `video` as a local directory with its contents.
81 We assume that a power failure causes the operation to stop unexpectingly
82 before it's completed.
84 .. code-block:: console
86 $ kamaki file download -R /pithos/video
88 Downloading /pithos/video/tk1.mpg --> /home/someuser/video/tk1.mpg
90 Downloading /pithos/video/tk2.mpg --> /home/someuser/video/tk2.mpg
93 After we recover the terminal , we find out that `tk1.mpg` had been downloaded
94 while `tk2.mpg` download is incomplete.
96 .. code-block:: console
102 Resume the download (use -f)
104 .. code-block:: console
106 $ kamaki file download -r -f /pithos/video
107 Resuming /pithos/video/tk2.mpg --> /home/someuser/video/tk2.mpg
108 Downloading /pithos/video/tk3.mpg --> /home/someuser/video/tk3.mpg
111 .. note:: The -f/--force argument is used for resuming or overwriting a file.
112 The result of using the argument is always the same: the local file will be
113 the same as the remote one.
118 .. code-block:: console
120 $ kamaki file upload -r -f . /pithos
123 .. note:: In this case, all files were already uploaded, so kamaki didn't have
124 to upload anything. If a file was modified, kamaki would sync it with its
127 .. note:: The **/pithos** argument means "from container **pithos**", which is
128 the default container. If a user needs to upload everything to another
129 container e.g., **images**:
131 .. code-block:: console
133 $ kamaki file upload -r -f . /images
138 .. code-block:: console
140 $ kamaki file download -r -f /pithos .
143 .. note:: Kamaki determined that all remote objects already exist as local files
144 too, so there is nothing to be done. If a new remote object was created or
145 an old one was modified, kamaki would have sync it with a local file.