SprightlySoft - Connecting you to the cloud.
 

S3 Delete - Documentation

S3 Delete allows you to delete files on Amazon S3.  It is a command line program and the command line parameters allow you to choose which files to delete.

Requirements

The application requires a Microsoft Windows computer running the Microsoft .NET Framework 4.  You will also need an Amazon AWS account with S3 enabled.

How to Run the Program

Open a command prompt window where S3Delete.exe is located.  Do this by holding down the Shift key on your keyboard and right clicking the S3Delete folder.  From the context menu click Open command window here.  A command prompt window will open.  Type S3Delete.exe and the command line parameters you require to delete your files.  Here is an example of what you would type:

S3Delete.exe -AWSAccessKeyId xxxxxxxxxxxx -AWSSecretAccessKey xxxxxxxxxxxxxx -BucketName mybucket -S3KeyName "my folder/"

Command Line Parameters

The following describes the parameters of S3 Delete.

-AWSAccessKeyId (required) - Your AWS access key ID provided by Amazon.

-AWSSecretAccessKey (required) - Your AWS secret access key provided by Amazon.

-UseSSL (optional) - Specifies whether SSL should be used when communicating with Amazon.  The default value is true.

  • True - Request URLs to Amazon will begin with https://.
  • False - Request URLs will begin with http://.

-RequestEndpoint (optional) - The endpoint to use in request URLs to Amazon. If no value is specified the application will determine which endpoint to use based on the location of your bucket.

-BucketName (required) - The name of the S3 bucket where you will be deleting files from.

-S3KeyName (optional) - The key name of the Amazon S3 object you want to delete.  This can be a folder key name of a file key name.  A folder key name looks like "rootfolder/subfolder/".  The object needs to exist before the program starts.  Use an empty value if you want to delete all files in the bucket.

-LogOnlyMode (optional) - Specifies whether deletes should be performed on S3 or if deletes should only be logged and no actions should be performed.  The default value is true.

  • True - the program will run, check which files would be deleted, and report these deletes. The program will not delete any files on S3.
  • False - The program will delete and the required files on S3.

-OutputLevel (optional) - Specifies what level of logging the program should output.  The default value is 1.

  • 1 - Minimal logging.  Shows basic information while the program is running.
  • 2 - Full logging.  Show all files that exist on S3 and each file that is deleted.  Debug information is shown in the event of an error.

-LogFilePath (optional) - The path and file name where a log file will be generated.  Leave this value empty if you do not want to create a text log file with log information when the program runs.  The path will look like "C:\S3DeleteLog.txt".

-OverwriteExistingLogFile (optional) - Specifies whether an existing log file should be overwritten when the program runs.  The default value is true.

  • True - Delete the existing log file when the program starts.  The log file will only contain data about the current execution of the program.
  • False - Append to the existing log file and do not overwrite data.

-ShowProgress (optional) - Indicates weather progress should be displayed in the console while deletes are taking place.  The default is true.

  • True - Show the number if files deleted and the total number of files to delete.
  • False - Do not show progress while deleting.

-S3ErrorRetries (optional) - The number of times a failure communicating with S3 should be retried.  The delay between retries increases as the number of retries increases.  Only certain errors are retried such as a connection timeout errors and 503 responses from Amazon.  The default value is 10.

-DeleteSubFolders (optional) - Specifies whether sub folders of your S3KeyName should be deleted from S3.  The default value is true.

  • True - Delete all sub folders that exist in the S3KeyName path.
  • False - Do not delete sub folders.  Only delete files in the S3KeyName path.

-DeleteSpecifiedFolder (optional) - Delete's the S3KeyName item if it is a folder.  The default value is true.

  • True - Delete the S3KeyName folder.
  • False - Do not delete the S3KeyName folder.

-IncludeOnlyLocalFilesRegularExpression (optional) - Only delete files where the file names match the regular expression.  Example; use ".*\.txt$" to only delete files that end with .txt.

-ExcludeLocalFilesRegularExpression (optional) - Do not delete files that match the regular expression.  Example; use ".*\.(jpg|gif|jpeg)$" to exclude files that end with . jpg, .gif, or . jpeg from deletion.

-DeleteFilesOlderThanDays (optional) - Only delete files older than the specified number of days.  A value with decimals is valid.  Use 0 to delete all files regardless of their age.  The default value is 0.

-EmailLogCondition - Specifies under what conditions an email should be sent when the program completes.  The email will contain the log of the program's operation.  The default value is 0.

  • 0 - Never send an email.
  • 1 - Send an email when there is an error.
  • 2 - Always send an email when the program completes.

-EmailSmtpHost (optional) - The SMTP server used to send the email.

-EmailSmtpPort (optional) - The port of the SMTP server.

-EmailSmtpEnableSsl (optional) - If SSL should be used with the SMTP server.

-EmailSmtpUserName (optional) - The user name to log into the SMTP server.  Keep this value empty is your SMTP server does not require authentication.

-EmailSmtpPassword (optional) - The password used to log into the SMTP server.

-EmailFromAddress (optional) - The from address to be used in the email.

-EmailRecipients (optional) - The email addresses the email will be sent to.  Separate multiple addresses with a comma.

Setting Parameters In the .Config File

Parameters can be set in the .config file so you do not have to pass them each time as command line parameters.  This is useful for AWSAccessKeyId and AWSSecretAccessKey as they do not change often.  Open the S3Delete.exe.config file in a text editor such as Notepad and enter a value for a key.

Concurrent Deletes

S3 Delete uses the Microsoft .NET Framework 4 Task Parallel Library to make simultaneous calls to Amazon S3 to delete files.  The Task Parallel Library used the optimum number of concurrent calls to S3 based on your computer's configuration.  This included the number of cores in your CPU and the workload your computer is currently performing.

 

 


 
© 2024  SprightlySoft