Amazon S3的目录复制到另一个目录 [英] Amazon S3 copy the directory to another directory
问题描述
如何复制/复制包含子文件夹和文件到S3存储在另一个目录中使用PHP的API文件夹?
How do i copy/duplicate a folder that contain sub-folders and files into another directory within the S3 bucket using PHP API?
$ S3-> copy_object只复制的文件夹,而不是文件和内部子文件夹。
$s3->copy_object only copies the folder, but not the files and sub-folders inside.
我必须使用$ S3-> list_objects让所有的文件和目录,然后运行$ S3-> copy_object上每一个文件/目录?
Do i have to use $s3->list_objects to get all files and directory and run $s3->copy_object on every single file/directory?
推荐答案
S3是不是一个文件系统,它是一个对象存储。文件夹实际上不存在任何实际意义;一个文件夹是只是一些你可以调用的共享preFIX。换句话说,如果你创建路径/要/一个
和路径/要/两个
,它没有也原因路径
和路径/到
存在。如果你看到他们,这是因为一些组件了对象的列表,分裂他们的钥匙放在 /
,并决定显示列表作为一个层次。
S3 is not a filesystem, it's an object store. Folders don't actually exist in any tangible sense; a folder is just something you can call a shared prefix. Put another way, if you create path/to/one
and path/to/two
, it doesn't also cause path
and path/to
to exist. If you see them, that's because some component took a list of objects, split their keys on /
, and decided to display that list as a hierarchy.
您想复制一个文件夹到另一个文件夹。这改写成S3而言,要重复使用相同的preFIX所有对象与不同的preFIX对象。说这种方式使得该方法明确:获得与一个preFIX对象的列表,然后复制他们每个人
You want to "duplicate a folder into another folder". Rephrasing this into S3 terms, you want to "duplicate all objects with the same prefix into objects with a different prefix". Saying it that way makes the method clear: get a list of objects with the one prefix, then copy each of them.
这篇关于Amazon S3的目录复制到另一个目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!