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> [<contentType>]]]

upload_multiple <fileType> <localFileList> <cloudFoldername> [<encrypted> [<timeToLive> [<contentType>]]]

download <fileType> <cloudFilename> <localFilename>

file_list | list <fileType> <cloudFileSpec> [<startAfter> [<count> [<from> [<to>]]]]

folder_list <fileType> <cloudFoldername> [<prefix> [<startAfter> [<count> [<from> [<to>]]]]]

delete <fileType> <cloudFileSpec> [<from> [<to>]]

rename <fileType> <cloudFilename> <newCloudFilename>

Where...

fileType

The file type: media, msg_media or rest. upload and rename only support media and msg_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.

cloudFoldername

A path to a folder on one of the cloud file stores.

prefix

A prefix that is to match any folders or files within a folder. This cannot contain '/' characters. If prefix is set to a single asterisk character or a single dot character, then all folders or files within a folder will be matched (the default).

newCloudFilename

The name of the renamed file on the cloud file store.

cloudFileSpec

A specification of files on the chosen cloud file store. This can be either the name of a single file, a partial file path with a trailing asterisk, a single asterisk character or a single dot character. If cloudFileSpec is set to a partial file path with a trailing asterisk, this specifies all files that start with that file path. If cloudFileSpec is set to a single asterisk or a single dot character, then this specifies all files on the cloud file store.

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, or U for unlimited (e.g. 24H is 24hours).

contentType

The content type (also called the MIME type) of the uploaded file(s) (e.g. "image/jpeg"). If not specified this is derived from the filename extension. Set it here if it needs to be overridden. If specified for upload_multiple all the files must be the same type.

startAfter

If listing a large number of files, this specifies the last filename in the previous file list after which to list more files. It is the name of a file on the media, message media or rest logs cloud file store including path or "-" to list from the start. If specified this should be the filename from the previous list which has its startafter property set. If this is specified as an integer, it is used as the DEPRECATED startpos argument.

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

The commands upload, upload_multiple and rename only support the media and msg_media fileTypes.

Note

File lists are sorted in chronological order and display 'e' for those files that are encrypted.

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

  1. Upload a Media file

    python manage_files.py 1-2-0 bob@acompany.com 6b4UmwoOPxjeI2M76aebfQ upload media c:/test/welcome.wav /wavs/welcome.wav
    
  2. Upload a Message Media file

    python manage_files.py 1-2-0 bob@acompany.com 6b4UmwoOPxjeI2M76aebfQ upload msg_media c:        estanner1.png /banners/banner1.png
    
  3. Upload an encrypted Media file

    python manage_files.py 1-2-0 bob@acompany.com 6b4UmwoOPxjeI2M76aebfQ upload media c:/test/encrypted/welcomeE.wav /wavs/encrypted/welcome.wav true
    
  4. Upload a Media 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
    
  5. Upload an encrypted Media 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
    
  6. Upload multiple encrypted Media files, delete them from the cloud after 30 minutes

    python manage_files.py 1-2-0 bob@acompany.com 6b4UmwoOPxjeI2M76aebfQ upload_multiple media "C:  est\my_uploads.txt" my_cloud_files/wavs/ true 30m
    
  7. 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
    
  8. Download a Message Media file

    python manage_files.py 1-2-0 bob@acompany.com 6b4UmwoOPxjeI2M76aebfQ download msg_media /received/1423/1876278.png c:   estb3876278.png
    
  9. 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
    
  10. List all Media files

    python manage_files.py 1-2-0 bob@acompany.com 6b4UmwoOPxjeI2M76aebfQ file_list media *
    
  11. List Media files in a particular directory

    python manage_files.py 1-2-0 bob@acompany.com 6b4UmwoOPxjeI2M76aebfQ file_list media /recordings/*
    
  12. List Message Media folders and files in a particular directory

    python manage_files.py 1-2-0 bob@acompany.com 6b4UmwoOPxjeI2M76aebfQ folder_list msg_media recordings/
    
  13. List the first 5 Media files found in a directory

    python manage_files.py 1-2-0 bob@acompany.com 6b4UmwoOPxjeI2M76aebfQ file_list media archive/* - 5
    
  14. List the first 7 Media files found in a directory, starting after a particular file

    python manage_files.py 1-2-0 bob@acompany.com 6b4UmwoOPxjeI2M76aebfQ file_list media archive/* archive/rec119.wav 7
    
  15. List the first 10000 Media files created after a particular date

    python manage_files.py -2-0 bob@acompany.com 6b4UmwoOPxjeI2M76aebfQ file_list media /faxs/received/* - 10000 2019-02-02T12:00:00
    
  16. List the first 10000 Media files created inbetween dates

    python manage_files.py 1-2-0 bob@acompany.com 6b4UmwoOPxjeI2M76aebfQ file_list media /faxs/received/* - 10000 2019-02-02T12:00:00 2019-02-03T16:00:00
    
  17. List the REST log files in a particular directory

    python manage_files.py 1-2-0 bob@acompany.com 6b4UmwoOPxjeI2M76aebfQ file_list rest /2019/02/*
    
  18. Delete a Media file

    python manage_files.py 1-2-0 bob@acompany.com 6b4UmwoOPxjeI2M76aebfQ delete media /recordings/2019_01_03_19924.wav
    
  19. Delete several Media files

    python manage_files.py 1-2-0 bob@acompany.com 6b4UmwoOPxjeI2M76aebfQ delete media /recordings/*
    
  20. 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
    
  21. 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
    
  22. Delete multiple REST log files

    python manage_files.py 1-2-0 bob@acompany.com 6b4UmwoOPxjeI2M76aebfQ delete rest /2019/02/*
    
  23. Rename a Media file

    python manage_files.py 1-2-0 bob@acompany.com 6b4UmwoOPxjeI2M76aebfQ rename media /wavs/old/prompt1.wav /wavs/prompt1.wav