发布于 2015-05-16 16:33:40
您应该使用正式的python-迅捷客户端包,并简单地:
# load your openstack credentials
source openrc.sh
cd path_to_directory_you_want_to_sync
# upload all the files recursively keeping good paths
swift upload --changed your_container *
Swift不支持类似rsync的同步,但我使用这个小脚本在容器中删除您在本地删除的文件,并上传新文件,而不要求without对每个文件进行比较:
#!/bin/bash
cd $2
diff <(find * -type f -print | sort) <(swift list $1 | sort) | while read x; do
if [[ $x == \>* ]]; then
echo "Need to delete ${x:2}"
swift delete $1 "${x:2}"
elif [[ $x == \<* ]]; then
echo "Need to upload ${x:2}"
swift upload $1 "${x:2}"
fi
done
cd -
用于:
./swift_sync.sh your_container directory_to_sync
发布于 2015-11-09 20:16:07
https://stackoverflow.com/questions/29803294
复制相似问题