Upload a directory: An OSS SDK does not support uploading a directory directly. However, you can upload multiple objects into the same logical directory by setting the same prefix for their object names, followed by a forward slash (/). For example, to upload the files 'example1.txt', 'example2.txt', and 'example3.txt' to a directory named 'dir', you can use the OSS SDK for Java to set the objectName for each object to dir/example1.txt, dir/example2.txt, and dir/example3.txt.
Download a directory: An OSS SDK does not support downloading a directory directly. You can only download individual objects within a directory by specifying their full object names. For example, to download all objects from a directory named 'folder' in a bucket to a local directory named 'local':
If you know the object names in the 'folder' directory
For example, if the 'folder' directory contains 'example1.jpg' and 'example2.jpg', you can use the OSS SDK for Java to download them. Set the objectName values to folder/example1.jpg and folder/example2.jpg, and the corresponding local download paths (pathName) to local/folder/example1.jpg and local/folder/example2.jpg.
If you do not know the object names in the 'folder' directory
List all objects in the directory by calling the GetBucket (ListObjects) API operation.
Iterate through the list of objects and download each one by setting its objectName and pathName as described previously.
For sample code on uploading and downloading objects with OSS SDKs for various programming languages, see Introduction to OSS SDKs.