aclean Reference

The Aspera aclean command-line tool is a fast method of deleting directories and files from local and object storage. Directories and files can be filtered based on their last modified times. For Windows operating systems, the created time (CTIME) and modified time (MTIME) are used as the matching criteria. You can do a dry run of an aclean command to test what content will be deleted. aclean can be run on any platform on which Ascp 4 is supported.

Note: The directory specified in an aclean command is not deleted. Only the content in the directory that matches the options is deleted.

Syntax

aclean [options] directory

Directory path format

  • Local paths: Paths to local storage can be full or relative paths, and use "/" separators for all operating systems, including Windows. Full Windows paths must use the format /c:/path/to/delete.
  • Object storage: Specify a path to object storage with its URI. For example, Azure storage has the syntax azu://storage_account:storage_access_key@blob.core.windows.net/path_to_blob and a URL to AWS S3 has the syntax s3://access_id:secret_key@s3.amazonaws.com/my_bucket/path. For more information on URL syntax for other object storage types, see Ascp Transfers with Object Storage and HDFS. The variable components of the URI must be URL encoded.

Options

Option (short version, long version) Description
-h, --help Display help.
-A, --version Display version.
-L, --logdir Set the filepath for the log directory.
-n, --dry-run Run the command as a trial to show what content would be deleted.
-t, --threads Set the number of threads to use to scan the directory. (Default: 8)
--remove-empty-dirs Delete empty subdirectories from the specified directory.
--remove-newer-than=MTIME Delete files that are newer than MTIME. MTIME is a date and time string with the format YYYY-mm-dd HH:MM. The timestamp is based on the local time of the machine.
--remove-older-than=MTIME Delete files that are older than MTIME. MTIME is a date and time string with the format YYYY-mm-dd HH:MM. The timestamp is based on the local time of the machine.

Examples

Delete the contents of the local directory /temp/logs-test/:

$ aclean /temp/logs-test/

View what files would be deleted if /temp/logs-test/ is deleted:

$ aclean --dry-run /temp/logs-test/

Delete subdirectories in /temp/logs-test/ if they are empty:

$ aclean --remove-empty-dirs /temp/logs-test/

Delete files that have a last-modified time older than March 27, 2017 13:34 from Azure object storage:

$ aclean --remove-older-than=2017-03-27 13:34 azu://user:key@blob.microsoft.com