Quantcast

Parameters

This page details the parameters accepted by this tool in the command line and their meaning. For version 1.0.0 of the tool, the following parameters are accepted (please note that parameters in bold red are required, the others are optional):

  • -a or --access -- specifies the AWS access key
  • -s or --secret -- specifies the AWS secret key
  • -b or --bucket -- specifies the S3 bucket name
  • -d or --dir -- specifies a directory to filter entries by. All the operations will only be performed on files under this directory (if any). Please note that when you specify a directory using this parameter you don't need to include the trailing slash (/), if not present, the code will append it automatically.
  • -bd or --before-date -- specifies a "before date" to filter by. Only entries which are older than the specified before date will be processed. NOTE: For details on formats accepted by this tool, please see this page on the wiki .
  • -ad or --after-date -- specifies an "after date" to filter by. Only entries which are newere than the specified after date will be processed. NOTE: For details on formats accepted by this tool, please see this page on the wiki .
  • --limit N -- specifies a limit for returned result. This limit applies to listing versions/orphans/etc. The number specified needs to be a positive integer, if 0 (zero) is specified, no limit of the results is employed, while a negative value will trigger an error and program will stop.
    Please note that this limit is applied after any other filters have been applied (if any). This means for instance when listing versions after a certain date and limiting the results to only showing first 10 entries, if no results are found, it means that no results after the given date were found, rather than the fact that the first 10 results returned were not after the given date.

In addition to the above, the tool supports the following commands which are still specified as parameters in the command line. Please note that only one command at a time can be specified -- as such, including 2 commands at the same time would render an error.

  • -h or --help -- brings up the help screen
  • -lv -- lists all version in the bucket which satisfy the filtering criteria (if any applied via the date parameters etc).
  • -lo -- lists all orphan files in the bucket which satisfy the filtering criteria (if any applied via the date parameters etc). An orphan file is one where the most recent version of the file is a delete marker -- as such, this file will NOT appear in the S3 listing when using any of the standards S3 browsers (Amazon's own, web-based, included!).
  • -purge -- Purges the bucket. This command deletes all the versions which satisfy the filtering criteria. If no filtering criteria specified (e.g. via command line arguments like -bd etc.), the all versions in the bucket are deleted.

Examples

The following command lists all orphaned versions in a bucket:

java -jar aws-version-mgmt.jar -a ... -s ... -b MyBucket -lo

The following command deletes all versions older than 21/Jan/2013 in a bucket:

java -jar aws-version-mgmt.jar -a ... -s ... -b MyBucket --before-date 2013-01-21 -purge

The following command lists all versions created after 14/Feb/2013 in a bucket:

java -jar aws-version-mgmt.jar -a ... -s ... -b MyBucket --after-date 2013-02-14 -lv