Manage Files Sample¶
A command line console application that provides access to the file management facilities of the Aculab Cloud Web Services API.
Usage¶
python manage_files [--wsserver <cloudWebServerAddress>] <cloudId> <username> <apiAccessKey> <command>
Arguments¶
cloudWebServerAddress
The address of the cloud web server. By default the wrappers call web services on
https://ws-<cloudId>.aculabcloud.net
. In certain circumstances you may need to use a different address which you can set here.
cloudId
Cloud region id (e.g. 1-2-0)
username
Cloud account username
apiAccessKey
Cloud API Access key
command
One of the following...
upload <fileType> <localFilename> <cloudFilename> [<encrypted> [<timeToLive>]]
upload_multiple <fileType> <localFileList> <cloudFilePath> [<encrypted> [<timeToLive>]]
download <fileType> <cloudFilename> <localFilename>
list <fileType> <cloudFileSpec> [<start> [<count> [<from> [<to>]]]]
delete <fileType> <cloudFileSpec> [<from> [<to>]]
rename <fileType> <cloudFilename> <newCloudFilename>
Where...
fileType
The file type: media or rest. upload and rename only support media.
localFilename
The name of a file on the local file system.
localFileList
The name of a text file containing a list of names of one or more media files on the local file system, one per line.
cloudFilename
The name of a file on the cloud file store. For upload from a file listing this is a path on the cloud media file store where the files will be uploaded.
newCloudFilename
The name of the renamed file on the cloud file store.
cloudFileSpec
A specification of files on the cloud file store. This can be the name of a single file or the first part of a file path followed by a trailing wildcard character '*'. This matches all files starting with cloudFileSpec. The wildcard character can only be specified at the end of the string.
encrypted
'true' or 't' to specify that the file(s) being uploaded is encrypted (case-insensitive) or 'false' or 'f' for non-encrypted files. The default is 'false'.
timeToLive
The lifetime of the uploaded file(s). This is a time period expressed as a number followed by a units character - one of 'D' or 'd' for days, 'H' or 'h' for hours, 'M' or 'm' for minutes. (e.g. 24H is 24hours)
start
The index of the first file to list. The default is 0.
count
The maximum number of files to list. The default is 10000. The maximum this can be set to is 10000.
from
List/delete only files after the UTC date and time specified in the ISO 8601 format yyyy-mm-ddThh:mm:ss (e.g. 2019-02-13T11:22:02).
to
List/delete only files before the UTC date and time specified in the ISO 8601 format yyyy-mm-ddThh:mm:ss (e.g. 2019-02-13T11:23:02).
Note
For users running Python 2 under Windows, this tool does not support command line arguments containing non-ASCII characters. If you wish to specify command line arguments containing non-ASCII characters, please use Python 3.
Examples¶
Upload a file
python manage_files.py 1-2-0 bob@acompany.com 6b4UmwoOPxjeI2M76aebfQ upload media c:/test/welcome.wav /wavs/welcome.wav
Upload an encrypted file
python manage_files.py 1-2-0 bob@acompany.com 6b4UmwoOPxjeI2M76aebfQ upload media c:/test/encrypted/welcomeE.wav /wavs/encrypted/welcome.wav true
Upload a file, delete it from the cloud after 16 hours
python manage_files.py 1-2-0 bob@acompany.com 6b4UmwoOPxjeI2M76aebfQ upload media c:/test/tempWelcome.wav /wavs/tempwelcome.wav f 16H
Upload an encrypted file, delete it from the cloud after 30 minutes
python manage_files.py 1-2-0 bob@acompany.com 6b4UmwoOPxjeI2M76aebfQ upload media "C:/test/my_uploads.txt" my_cloud_files/wavs/ true 30m
Download a media file
python manage_files.py 1-2-0 bob@acompany.com 6b4UmwoOPxjeI2M76aebfQ download media /recordings/recording1.wav c:/test/recordings/recording1.wav
Download a REST log file
python manage_files.py 1-2-0 bob@acompany.com 6b4UmwoOPxjeI2M76aebfQ download rest /2019/02/07/rest_12_19_35_058d242936dcc5f9.47610.log c:/test/restapi/logs/2019_02_07/rest_12_19_35_058d242936dcc5f9.47610.log
List all media files
python manage_files.py 1-2-0 bob@acompany.com 6b4UmwoOPxjeI2M76aebfQ list media *
List media files in a particular directory
python manage_files.py 1-2-0 bob@acompany.com 6b4UmwoOPxjeI2M76aebfQ list media /recordings/*
List the media files indexed from 0 to 999
python manage_files.py 1-2-0 bob@acompany.com 6b4UmwoOPxjeI2M76aebfQ list media * 0 1000
List the media files indexed from 1000 to 1999
python manage_files.py 1-2-0 bob@acompany.com 6b4UmwoOPxjeI2M76aebfQ list media * 1000 1000
List the first 10000 media files created after a particular date
python manage_files.py 1-2-0 bob@acompany.com 6b4UmwoOPxjeI2M76aebfQ list media * 0 10000 2019-02-02T12:00:00
List the first 10000 media files created inbetween dates
python manage_files.py 1-2-0 bob@acompany.com 6b4UmwoOPxjeI2M76aebfQ list media /recordings/rec* 0 10000 2019-02-02T12:00:00 2019-02-03T16:00:00
List the REST log files in a particular directory
python manage_files.py 1-2-0 bob@acompany.com 6b4UmwoOPxjeI2M76aebfQ list rest /2019/02/*
Delete a media file
python manage_files.py 1-2-0 bob@acompany.com 6b4UmwoOPxjeI2M76aebfQ delete media /recordings/2019_01_03_19924.wav
Delete several media files
python manage_files.py 1-2-0 bob@acompany.com 6b4UmwoOPxjeI2M76aebfQ delete media /recordings/*
Delete several media files that were create inbetween dates
python manage_files.py 1-2-0 bob@acompany.com 6b4UmwoOPxjeI2M76aebfQ delete media /recordings/* 2019-02-02T12:00:00 2019-02-03T16:00:00
Delete a REST log file
python manage_files.py 1-2-0 bob@acompany.com 6b4UmwoOPxjeI2M76aebfQ delete rest /2019/02/07/rest_12_19_35_058d242936dcc5f9.47610.log
Delete multiple REST log files
python manage_files.py 1-2-0 bob@acompany.com 6b4UmwoOPxjeI2M76aebfQ delete rest /2019/02/*
Rename a media file
python manage_files.py 1-2-0 bob@acompany.com 6b4UmwoOPxjeI2M76aebfQ rename media /wavs/old/prompt1.wav /wavs/prompt1.wav