Amazon S3 functions as an object storage service, which means there isn't a native concept of "folders" or "directories" as in traditional file systems. The folder-like hierarchy we see in S3 is emulated using object key naming conventions and isn't inherent to S3 itself.
A common method to signify these "folders" in S3 is by creating zero-byte objects with a trailing slash (/
). This convention, while widely used, isn't standardized or enforced by AWS, leading to different behaviors across various S3 clients, and, as you’ve found, many clients don’t observe it. CompleteFTP, when interfacing with S3, does observe the convention and creates such a zero-byte object to represent folders. The timestamp of this object then serves as the folder's timestamp when our "Accurate Timestamps" feature is enabled (these have to be fetched individually, which is slow if there are many subfolders - hence the warning in the GUI).
Your observations, such as timestamps of 1/18/2038 in Filezilla and 1/1/1900 in WinSCP, likely stem from situations where these clients encounter a "folder" without its corresponding zero-byte object. This mismatch can result in them defaulting to these dates. The correct timestamp for a new root folder created via CompleteFTP, versus the discrepancies in its subfolders, aligns with this behavior.
If your use-case relies on folders and files being created by S3 clients other than CompleteFTP, then it’s going to be hard to avoid this issue, though there are a couple of workarounds that try to ensure that there are zero-byte folder objects for all ‘folders’ in your bucket:
Batch folder-object creation script:
Purpose: This script is designed to scan an existing S3 bucket and create any missing zero-byte 'folder' objects. It's especially useful for rectifying the current state of your bucket, ensuring all "folders" have their corresponding zero-byte representation.
Execution: The script can be run on your local machine, provided you have Python and the boto3
library installed. Additionally, you would need to set up AWS credentials on your machine (typically done using the AWS CLI). Alternatively, for an environment closer to AWS, you could run it on an Amazon EC2 instance with the necessary permissions.
Real-time folder-object creation using a AWS Lambda Function:
Purpose: This function is designed to automatically ensure the presence of a zero-byte 'folder' object in the S3 bucket every time a new object is added or an existing object is modified. It aims to provide a more automated and real-time solution for maintaining consistent folder timestamp behavior.
Execution: Once set up, this function would be triggered by S3 bucket events, meaning it would run automatically in response to changes in your bucket without manual intervention.
Configuration: To set this up, you'd configure your S3 bucket to trigger this Lambda function upon specific events (like object creation).