Reputation: 1833
I have the following code to put a file on to an Amazon S3 bucket and then retrieve the directory listing:
<!--- set a variable to hold our S3 directory --->
<cfset s3Dir = "s3://#access_ID#:#secret_key#@bucket/folder/">
<!--- check if directory exists and create if not --->
<cfif not directoryExists(s3Dir)>
<cfset directoryCreate(s3Dir)>
</cfif>
<!--- create a random file with a random number as its content --->
<cfset fileWrite
('#s3Dir#/RandomFile_#DateFormat(Now(),'yyyymmdd')#-#TimeFormat(Now(),'HHmmss')#.txt',
'#RandRange(100000,100000000)#')>
<!--- get the directory contents --->
<cfdump var="#directoryList(s3Dir)#">
The file saves to Amazon S3 correctly and I can see it using the S3 console. But the dumped out directory contents is always an empty array. Any ideas as to why this might be?
Upvotes: 2
Views: 752
Reputation: 1833
I have just found the answer on Adobe's bug base at https://bugbase.adobe.com/index.cfm?event=bug&id=3554224
It is caused by having a trailing slash at the end of the directory path. Once I remove the trailing slash and restarted CF the file names are returned as expected.
Upvotes: 4