mc mirror --exclude-storageclass GLACIER \
--exclude-storageclass DEEP_ARCHIVE SRCALIAS/SRCPATH TGALIAS/TGPATH
Replace SRCALIAS
with the alias
of a configured S3 host.
Replace SRCPATH
with the bucket to mirror.
Replace TGTALIAS
with the alias
of a configured S3 host.
Replace TGTPATH
with the destination bucket.
mc mirror --watch
command continuously synchronizes the source and destination targets for added and deleted objects.
This includes automatically removing objects on the destination if they are removed on the source.
For objects updated on the source to also update on the target, use –overwrite.
To remove objects from the target that are not on the source, use –remove.
mc mirror --watch
relies on the mc
removal API for deleting objects. As part of
removing the last object in a bucket prefix, mc
also recursively removes
each empty part of the prefix up to the bucket root. mc
only applies the
recursive removal to prefixes created implicitly as part of object write
operations - that is, the prefix was not created using an explicit directory
creation command such as mc mb
.
For example, consider a bucket photos
with the following object prefixes:
photos/2021/january/myphoto.jpg
photos/2021/february/myotherphoto.jpg
photos/NYE21/NewYears.jpg
photos/NYE21
is the only prefix explicitly created using mc mb
.
All other prefixes were implicitly created as part of writing the object
located at that prefix.
If an mc
command removes myphoto.jpg
, the removal API automatically
trims the empty /january
prefix. If a subsequent mc
command removes
myotherphoto.jpg
, the removal API automatically trims both the /february
prefix and the now-empty /2021
prefix. If an mc
command removes
NewYears.jpg
, the /NYE21
prefix remains in place since it was
explicitly created.
If using mc mirror --watch
for operations on a filesystem, mc
applies this same
behavior by recursively trimming empty directory paths up to the root. However,
the mc
remove API cannot distinguish between an explicitly created
directory path and an implicitly created one. If mc mirror --watch
deletes the last
object at a filesystem path, mc
recursively deletes all empty directories
within that path up to the root as part of the removal operation.
Privacy Policy.