Beware thee calling the #length method on a Fog::Storage::AWS::Files object! It seems to include recently destroyed files!
Instead, you should use #all.length
# Includes destroyed files!! Fog::Storage.new(my_connection).directories.get(my_directory).files.length # Better! Fog::Storage.new(my_connection).directories.get(my_directory).files.all.length