Return a list of all of the files/folders in the bucket.
If path is given, then it will be used as the root of the search.
Results are returned relative to path; if path is not given, then the results will contain the full S3 path.
The following all ultimately return one item referring to "path/to/my/file.ext"; however, by limiting the scope via path, the results are different.
-
files = s3FindFiles bucket: "my-bucket", glob: "path/to/my/file.ext"
// files[0].name = "file.ext"
// files[0].path = "path/to/my/file.ext"
-
files = s3FindFiles bucket: "my-bucket", path: "path/to/", glob: "my/file.ext"
// files[0].name = "file.ext"
// files[0].path = "my/file.ext"
-
files = s3FindFiles bucket: "my-bucket", path: "path/to/my/", glob: "file.ext"
// files[0].name = "file.ext"
// files[0].path = "file.ext"
List every file in the bucket:
- s3FindFiles bucket: "my-bucket", glob: "**", onlyFiles: true
The return format is identical to that of the findFiles step.
This will return an array of FileWrapper instances with the following properties:
- name: the filename portion of the path (for "path/to/my/file.ext", this would be "file.ext")
- path: the full path of the file, relative to the path specified (for path="path/to/", this property of the file "path/to/my/file.ext" would be "my/file.ext")
- directory: true if this is a directory; false otherwise
- length: the length of the file (this is always "0" for directories)
- lastModified: the last modification timestamp, in milliseconds since the Unix epoch (this is always "0" for directories)
When used in a string context, a FileWrapper object returns the value of its path.