Skip to main content

Command Line Tool for Qingstor.

Project description

### Qingstor command line tool
-------------------

Qsctl(Qingstor command line tool) provides more powerful unix-like commands. You
can manage Qingstor resources just like files on local machine. Unix-like commands
contains: cp, ls, mb, mv, rm, rb and sync. All of the them support batch processing.

- Installation

Install via pip

```
$ pip install qsctl
```

If not installed in virtualenv, maybe sudo is needed

```
$ sudo pip install qsctl
```

- Getting Started

To use qsctl, there must be a configuration file to configure your own
``qy_access_key_id`` , ``qy_secret_access_key`` and ``zone`` , such as::

```
qy_access_key_id: 'QINGCLOUDACCESSKEYID'
qy_secret_access_key: 'QINGCLOUDSECRETACCESSKEYEXAMPLE'
zone: 'pek3a'
```

The configuration file is saved in ``~/.qingcloud/config.yaml`` by default, it also
can be assigned by the parameter ``-f /path/to/config`` when executing the
command.

- Usages

```
cp - Copy local file(s) to qs object or qs object(s) to local.
local-path qs-uri or qs-uri local-path
-r, --recursive
--include <value>
--exclude <value>

ls - List qs objects under a prefix or list all qs buckets.
qs-uri or NONE
-r, --recursive
--page-size <value>
--zone <value>

mb - Create an qs bucket.
qs-uri
--zone <value>

mv - Move local file(s) to qs or qs object(s) to local.
local-path qs-uri or qs-uri local-path
-r, --recursive
--include <value>
--exclude <value>

rb - Delete an empty qs bucket or forcely delete nonempty qs bucket
qs-uri
--force

rm - Delete a qs object or more.
qs-uri
-r, --recursive
--include <value>
--exclude <value>

sync - sync directories and qs prefixes.
local-path qs-uri or qs-uri local-path
--delete
--include <value>
--exclude <value>
```

- Examples

- ls command

```
$ qsctl ls
mybucket1
mybucket2

$ qsctl ls qs://mybucket1
Folder test/
2016-04-03 11:16:04 4 Bytes test.txt
2016-04-03 11:16:04 4 Bytes temp.txt
2016-04-03 11:16:04 4 Bytes temp1.txt

$ qsctl ls qs://mybucket1 -r
2016-04-03 17:51:18 1.4 KiB test/test/standard
2016-04-03 11:16:04 4 Bytes test.txt
2016-04-03 11:16:04 4 Bytes temp.txt
2016-04-03 11:16:04 4 Bytes temp1.txt
```

- cp command

```
$ qsctl cp qs://mybucket1/test.txt test.txt
File 'test.txt' written

$ qsctl cp qs://mybucket1 test/ -r
File 'test/test.txt' written
File 'test/temp.txt' written
File 'test/temp1.txt' written
File 'test/test/test/standard' written

$ qsctl cp qs://mybucket1 test/ -r --exclude "*.txt"
File 'test/test/test/standard' written

$ qsctl cp qs://mybucket1 test/ -r --exclude "*" --include "*.txt"
File 'test/t.txt' written
File 'test/temp.txt' written
File 'test/temp1.txt' written
```

- mv command

```
$ qsctl mv qs://mybucket1/test.txt test.txt
File 'test.txt' written
Object <test.txt> deleted

$ qsctl mv qs://mybucket1 test/ -r
File 'test/test.txt' written
File 'test/temp.txt' written
File 'test/temp1.txt' written
File 'test/test/test/standard' written
Object <test.txt> deleted
Object <temp.txt> deleted
Object <temp1.txt> deleted
Object <test/test/standard> deleted

$ qsctl mv qs://mybucket1 test/ -r --exclude "*.txt"
File 'test/test/test/standard' written
Object <test/test/standard> deleted

$ qsctl mv qs://mybucket1 test/ -r --exclude "*" --include "*.txt"
File 'test/t.txt' written
File 'test/temp.txt' written
File 'test/temp1.txt' written
Object <test.txt> deleted
Object <temp.txt> deleted
Object <temp1.txt> deleted
```

- mb command

```
$ qsctl mb qs://mybucket2
Bucket <mybucket2> created
```

- rb command

```
$ qsctl rb qs://mybucket2
Bucket <mybucket2> deleted

$ qsctl rb qs://mybucket1 test/ --force
Object <test.txt> deleted
Object <temp.txt> deleted
Object <temp1.txt> deleted
Object <test/test/standard> deleted
Bucket <mybucket1> deleted
```

- rm command

```
$ qsctl rm qs://mybucket1/test.txt
Object <test.txt> deleted

$ qsctl rm qs://mybucket1 -r
Object <test.txt> deleted
object <temp.txt> deleted
Object <temp1.txt> deleted
Object <test/test/standard> deleted
```

- sync command

```
$ qsctl sync qs://mybucket3/test test/
File 'test/README.md' written
File 'test/commands.py' written
File 'test/commands.pyc' written
File 'test/issues.txt' written
File 'test/test.txt' written

$ qsctl sync qs://mybucket3/test test/ --delete
File 'test/README.md' written
File 'test/commands.py' written
File 'test/commands.pyc' written
File 'test/issues.txt' written
File 'test/test.txt' written
File 'test/others1.txt' deleted
File 'test/others2.txt' deleted
File 'test/others3.txt' deleted
File 'test/others4.txt' deleted
```

Project details


Release history Release notifications | RSS feed

This version

0.5

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page