如何使用Python语言复制具有文件的文件夹,还将具有不同文件的子文件夹与具有相同文件夹级结构的AWS S3 Bukcet

发布于 2025-01-28 15:07:06 字数 135 浏览 2 评论 0原文

大家好,您能帮助您弄清此问题

如何复制具有PY文件的文件夹,并且ASLO具有带有相同文件夹结构与ASW S3 Bucket Path的特定路径中存在的子文件夹级别文件。文件应以相同的方式反映它们的外观,就像文件夹级别,也应该在S3桶路径中相同

Hi all can you please help to figure out this issue

How to copy a folder having py files, and aslo having sub folder level files which are present in a particular path with the same folder structure to asw s3 bucket path. The files should be reflected as same in the way how they are look like folder level that should be same in s3 bucket path as well

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

暖风昔人 2025-02-04 15:07:06

为此,有一个完全露面的Python库。通过

pip install s3

文档写得很好,并且您毫不费力。示例部分显示了如何将文件上传到S3,

storage.write("example", remote_name, headers=headers)

您应该能够指示包裹在维护其文件夹结构的同时上传文件夹和子文件夹。如果需要单独选择需要上传的文件和文件夹,也可以使用os.walk浏览文件和目录。

There is a fully fledged Python library for this. Install it via

pip install s3

The documentation is well written and you should have no trouble following it. The examples section shows how to upload file to S3

storage.write("example", remote_name, headers=headers)

You should be able to instruct the package to upload the folders and subfolders while maintaining their folder structure. You can also use os.walk to walk through your files and directories if you need to individually pick which files and folders need to be uploaded.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文