find 快速查询文件
1
2
3
4
5
6
| 1. 指定条件越详细越好
2. 目录路径、文件类型、文件时间
比如:
find /tmp -mindepth 2 -maxdepth 2 -type f -mmin +4 -mmin -10
|
rsync 快速复制小文件
1
2
3
4
5
6
7
8
9
10
11
12
13
14
| rsync -azW --sockopts=TCP_NODELAY --partial
-azW: 复制文件属性; 已压缩方式传输; 拷贝文件,不进行增量检测
--inplace: 在目标文件上直接更新内容,不跟W一起使用
--sockopts=TCP_NODELAY: 关闭Nagle算法
--partial: 断点续传
遇到新服务器需要认证:
脚本中rsync 推送代码文件时,由于是新增的机器,第一次会提示:
Are you sure you want to continue connecting (yes/no)?
ssh 有-o PubkeyAuthentication=yes 的参数可以跳过
rsync -avuP -e "ssh -o PubkeyAuthentication=yes -o stricthostkeychecking=no" ${source_dir} root@${IP}:${des_dir}
|
##并行处理命令工具: parallel(未测试)
1
2
3
4
5
6
7
| ls /path/to/your/files/* | parallel -j 10 ossutil64 cp {} oss://your_bucket/your_directory/
ls /path/to/your/files/*: 会列出你要上传的所有文件;
parallel -j 10: 会启动 10 个并行进程;
ossutil64 cp {} oss://your_bucket/your_directory/:
是你要并行执行的命令,其中 {} 会被替换为每个文件的路径。
|