IBM Softlayer uses many types of storage to store the data. One of which is Amazon S3. I have written a simple script to delete IBM COS S3 files older than X days. 

The PS Script uses AWS CLI commands, so you will need AWS CLI installed on the windows machine from where you will run this script. The script can also be scheduled as a task to run every day.

 

 

PowerShell
Edit|Remove
# Iterate through each file 
foreach($s3_files_list_iterator in $s3_files_list) { 
    # Split the file entry to extrach the "created date" and "file name" 
    $s3_files_list_iterator_split_array = $s3_files_list_iterator.split(" ") 
    $temp_date_holder = $s3_files_list_iterator_split_array[0] 
    # Convert the created date from String format to DataTime format 
    $s3_files_list_iterator_date = [datetime]::ParseExact($temp_date_holder"yyyy-MM-dd"$null) 
    $s3_files_list_iterator_file_name = $s3_files_list_iterator_split_array[-1] 
 
    # Get the difference between each file's created date and current date. 
    # Subtract the two dates. If the difference is greather than 30 delete the file 
    if(($s3_files_list_iterator_date - (Get-date)).days -ge $FileAge){ 
        log $s3_files_list_iterator_file_name 
        # Constructing the file name <S3URI> to delete  
        $file_to_delete = $bucketname + "/" + $s3_files_list_iterator_file_name 
        aws --endpoint-url $endpoint s3 rm $file_to_delete --profile test 
 
    } 
} 
$cmdError = $?