I have a file transfer utility set up in Python using s3fs where I populate a list of files to download off of AWS by using the ls command to fill the list. I'm interested in trying to create another list containing only directories in that bucket.
In linux, I know this would be typically passed using ls -d */. The source documentation mentions s3fs has the ability to take linux commands (such as ls) which I have set up as follows:
fs = s3fs.S3FileSystem(anon=True, client_kwargs={'endpoint_url':"$url"})
# List objects in a path and import to array
files = fs.ls('dir/')
Is there a way to pass arguments to ls in this sense? Something like:
dirs = fs.ls(ls -d */ + 'dir')
This article references a package called "goofys" but I'd rather not download another API if I can avoid it.