Copying local files with curl [closed]

大城市里の小女人 提交于 2021-01-02 05:17:28

问题


Is there a way to copy local files with curl, I need it to work as an alternative for cp command.

This is a bit strange, but I'm working on an environment where cp is not available.


回答1:


You could say:

curl -o /path/to/destination file:///path/to/source/file 

This would copy /path/to/source/file to /path/to/destination.




回答2:


you can use rsync

rsync -avz /path/to/src/file /path/to/dst/dir

You can also use tar

cd /path/to/src/dir; tar -cpf - sourcefile | (cd /path/to/dest/dir; tar -xpf -)

if your tar support -C

cd /path/to/src/dir; tar -cpf - sourcefile | tar -xpf - -C /path/to/dest/dir


来源:https://stackoverflow.com/questions/21023048/copying-local-files-with-curl

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!