一:安装方法

#wget http://nchc.dl.sourceforge.net/project/s3tools/s3cmd/1.0.0/s3cmd-1.0.0.tar.gz   
#tar -zxf s3cmd-1.0.0.tar.gz -C /usr/local/   
#mv /usr/local/s3cmd-1.0.0/ /usr/local/s3cmd/   
#ln -s /usr/local/s3cmd/s3cmd /usr/bin/s3cmd

  

二:使用方法

  1.配置Access Key ID 和 Secret Access Key

 #s3cmd --configure

  

2.列举所有的Buckets

#s3cmd ls

  

  3.创建 bucket,且 bucket 名称是唯一的,不能重复。

#s3cmd mb s3://my-bucket-name

  

  4.删除空 bucket

#s3cmd rb s3://my-bucket-name

  

  5.列举 Bucket 中的内容

#s3cmd ls s3://my-bucket-name

  

  6.上传 file.txt 到某个 bucket

#s3cmd put file.txt s3://my-bucket-name/file.txt

  

  7.上传并将权限设置为所有人可读

#s3cmd put --acl-public file.txt s3://my-bucket-name/file.txt

  

  8.批量上传文件

#s3cmd put ./* s3://my-bucket-name/

  

  9.下载文件

#s3cmd get s3://my-bucket-name/file.txt file.txt

  

  10.批量下载

#s3cmd get s3://my-bucket-name/* ./

  

  11.删除文件

#s3cmd del s3://my-bucket-name/file.txt

  

  12.来获得对应的bucket所占用的空间大小

#s3cmd du -H s3://my-bucket-name

  

三:文件夹处理规则

  带"/"斜杠的 dir1,相当于上传yh目录下的所有文件,即类似 "cp ./* "

  

# s3cmd put -r yh s3://yaohong-bucket
  upload: 'yh/1' -> 's3://yaohong-bucket/yh/1' [1 of 4]
  0 of 0 0% in 0s 0.00 B/s done
  upload: 'yh/2' -> 's3://yaohong-bucket/yh/2' [2 of 4]
  0 of 0 0% in 0s 0.00 B/s done
  upload: 'yh/3.py' -> 's3://yaohong-bucket/yh/3.py' [3 of 4]
  0 of 0 0% in 0s 0.00 B/s done
  upload: 'yh/3.sh' -> 's3://yaohong-bucket/yh/3.sh' [4 of 4]
  0 of 0 0% in 0s 0.00 B/s done

  

四:同步方法

  1.同步当前目录下所有文件

#s3cmd sync  ./  s3://yaohong-bucket/

  2.加 "--dry-run"参数后,仅列出需要同步的项目,不实际进行同步。

#s3cmd sync  --dry-run ./  s3://my-bucket-name/

  3.加 " --delete-removed"参数后,会删除本地不存在的文件。

#s3cmd sync  --delete-removed ./  s3://my-bucket-name/

  4.加 " --skip-existing"参数后,不进行MD5校验,直接跳过本地已存在的文件。

#s3cmd sync  --skip-existing ./  s3://my-bucket-name/

  高级同步

排除、包含规则(--exclude 、--include)

  file1-1.txt被排除,file2-2.txt同样是txt格式却能被包含

# s3cmd sync --dry-run --exclude '*.txt' --include 'dir2/*' ./  s3://my-bucket-name/
exclude: dir1/file1-1.txt
upload: ./dir2/file2-2.txt -> s3://my-bucket-name/dir2/file2-2.txt

  从文件中载入排除或包含规则。(--exclude-from、--include-from)

#s3cmd sync  --exclude-from pictures.exclude ./  s3://my-bucket-name/

  排除或包含规则支持正则表达式

--rexclude 、--rinclude、--rexclude-from、--rinclude-from

  

S3cmd的更多相关文章

  1. 使用s3cmd操作ceph rgw

    安装1.sudo apt-get install -y python-pip sudo pip install s3cmd 2. sudo apt-get install s3cmd   配置 s3c ...

  2. 迅达云s3cmd客户端mac平台部署说明

    自己根据文档整理了下,在这里记下,免得其他兄弟走弯路. 1 下载最新的s3cmd代码 https://github.com/s3tools/s3cmd/archive/master.zip 2 解压缩 ...

  3. s3cmd的安装与配置

    安装包链接:http://files.cnblogs.com/files/litao0505/s3.rar 安装S3cmd1. tar -zxf s3cmd-1.0.0.tar.gz2. mv s3c ...

  4. s3cmd的安装与使用

     s3cmd 是一款 Amazon S3 命令行工具.它不仅能上传.下载.同步,还能设置权限,下面是完整的安装使用指南. 主要是还是用来储存日志文件或者其他什么资料. https://wangyan. ...

  5. ceph S3客户端操作--s3cmd

    S3 client 访问ceph rgw 安装: yum install s3cmd 验证安装是否成功: $s3cmd --version s3cmd version 1.5.2 #表示安装成功 在c ...

  6. s3cmd用法总结

    概述 S3是亚马逊AWS提供的简单存储服务(可以理解为有公网域名的大容量高可用存储) S3配合CloudFront服务可作为CDN使用,它提供多节点全球发布 安装 方法一: yum install s ...

  7. S3cmd命令行管理对象存储

    我的使用步骤 cd /usr/    目录 git clone https://github.com/jdcloud-cmw/s3cmd.git   下载文件 ln -s /usr/s3cmd/s3c ...

  8. s3cmd在配置后使用时提示ERROR: S3 error: 403 (InvalidAccessKeyId): The AWS Access Key Id you provided does not exist in our records.

    自己新建的ceph环境,下载了s3cmd来做客户端,使用了s3cmd --configure配置后,在使用s3cmd ls可以查看到所有的bucket,但s3cmd ls s3://xxx 具体buc ...

  9. s3cmd : Add a config parameter to enable path-style bucket access 当ceph rgw使用域名时,需要支持 path-style bucket特性

    s3cmd 要是1.6.1 之后的版本 增加配置项:  vi .s3cfg use_path_mode = True 源码参考: cat  /usr/local/lib/python2.7/dist- ...

  10. s3cmd安装

    配置yum.repos cd /etc/yum.repos.d/ vim s3tools.repo [s3tools] name=Tools for managing Amazon S3 - Simp ...

随机推荐

  1. [LeetCode] 136. Single Number 单独数

    Given a non-empty array of integers, every element appears twice except for one. Find that single on ...

  2. [LeetCode] 349. Intersection of Two Arrays 两个数组相交

    Given two arrays, write a function to compute their intersection. Example 1: Input: nums1 = [1,2,2,1 ...

  3. LeetCode:字符串相加【415】

    LeetCode:字符串相加[415] 题目描述 给定两个字符串形式的非负整数 num1 和num2 ,计算它们的和. 注意: num1 和num2 的长度都小于 5100.num1 和num2 都只 ...

  4. Java设计模式之:单例模式

    单例模式 建议实现方式:枚举方式实现单例 单例模式的定义 单例模式就是在程序运行中只实例化一次,创建一个全局唯一对象,有点像 Java 的静态变量,但是单例模式要优于静态变量,静态变量在程序启动的时候 ...

  5. 转载:Python Web开发最难懂的WSGI协议,到底包含哪些内容?

    原文:PSC推出的第二篇文章-<Python Web开发最难懂的WSGI协议,到底包含哪些内容?>-2017.9.27 我想大部分Python开发者最先接触到的方向是WEB方向(因为总是有 ...

  6. 高级UI-滤镜和颜色通道

    滤镜在图片处理里面有很多的运用,尤其是相机使用了大量的滤镜,通过对颜色通道的调和,可以呈现出各种各样的效果 对图像进行一定的过滤加工处理,使用Paint设置滤镜效果 很多高级UI使用时候需要关闭硬件加 ...

  7. 关于goquery的“non-standard import”错误

    goquery运行缺包就用get github.com\andybalholm\cascadia下到gopath,然后出现“non-standard import”错误,说明github.com\an ...

  8. asp.net Code CSRedis学习记录

    1.安装Redis for windows 安装地址 https://github.com/MicrosoftArchive/redis/releases Redis 是完全开源免费的,遵守BSD协议 ...

  9. Java线程读写锁

    排他锁和共享锁: 读写锁:既是排他锁,又是共享锁.读锁,共享锁,写锁:排他锁 读和读是不互斥的 import java.util.HashMap; import java.util.Map; impo ...

  10. Java线程volatile(二)

    volatile:使变量在多个线程中可见 在java 中每个线程都会有一块工作内存区,其中存放着所有线程共享的主内存中变量的拷贝.当线程执行时,在自己的工作内存区操作这些变量,为了存取一个共享的变量, ...