华为云AI开发平台ModelArts使用ma-cli拷贝OBS数据_云淘科技
使用ma-cli obs-copy [SRC] [DST]可以实现本地和OBS文件或文件夹的相互拷贝。
$ma-cli obs-copy -h Usage: ma-cli obs-copy [OPTIONS ] SRC DST Copy file or directory to between OBS and local path. Example: # Upload local file to OBS path ma-cli obs-copy ./test.zip obs://your-bucket/copy-data/ # Upload local directory to OBS path ma-cli obs-copy ./test/ obs://your-bucket/copy-data/ # Download OBS file to local path ma-cli obs-copy obs://your-bucket/copy-data/test.zip ./test.zip # Download OBS directory to local path ma-cli obs-copy obs://your-bucket/copy-data/ ./test/ Options: -d, --drop-last-dir Whether to drop last directory when copy folder. if True, the last directory of the source folder will not copy to the destination folder. [default: False] -C, --config-file PATH Configure file path for authorization. -D, --debug Debug Mode. Shows full stack trace when error occurs. -P, --profile TEXT CLI connection profile to use. The default profile is "DEFAULT". -H, -h, --help Show this message and exit.
参数名 |
参数类型 |
是否必选 |
参数说明 |
---|---|---|---|
-d / –drop-last-dir |
Bool |
否 |
若指定,在拷贝文件夹时不会将源文件夹最后一级目录拷贝至目的文件夹下,仅对文件夹拷贝有效。 |
命令示例
# 上传文件到OBS中
$ ma-cli obs-copy ./test.csv obs://${your_bucket}/test-copy/ [ OK ] local src path: [ /home/ma-user/work/test.csv ] [ OK ] obs dst path: [ obs://${your_bucket}/test-copy/ ]
# 上传文件夹到OBS中,对应上传到OBS的目录为obs://${your_bucket}/test-copy/data/
$ ma-cli obs-copy /home/ma-user/work/data/ obs://${your_bucket}/test-copy/ [ OK ] local src path: [ /home/ma-user/work/data/ ] [ OK ] obs dst path: [ obs://${your_bucket}/test-copy/ ]
# 上传文件夹到OBS中,并指定–drop-last-dir,对应上传到OBS的目录为obs://${your_bucket}/test-copy/
$ ma-cli obs-copy /home/ma-user/work/data/ obs://${your_bucket}/test-copy/ --drop-last-dir [ OK ] local src path: [ /home/ma-user/work/data ] [ OK ] obs dst path: [ obs://${your_bucket}/test-copy/ ]
# 从OBS下载文件夹到本地磁盘中
$ ma-cli obs-copy obs://${your_bucket}/test-copy/ ~/work/test-data/ [ OK ] obs src path: [ obs://${your_bucket}/test-copy/ ] [ OK ] local dst path: [ /home/ma-user/work/test-data/ ]
父主题: ModelArts CLI命令参考
同意关联代理商云淘科技,购买华为云产品更优惠(QQ 78315851)
内容没看懂? 不太想学习?想快速解决? 有偿解决: 联系专家