Linux 使用curl复制本地文件
有没有办法用curl复制本地文件,我需要它作为cp命令的替代品 这有点奇怪,但我正在一个无法使用cp的环境中工作。您可以说:Linux 使用curl复制本地文件,linux,unix,curl,Linux,Unix,Curl,有没有办法用curl复制本地文件,我需要它作为cp命令的替代品 这有点奇怪,但我正在一个无法使用cp的环境中工作。您可以说: curl -o /path/to/destination file:///path/to/source/file 这将把/path/to/source/file复制到/path/to/destination您可以使用rsync rsync -avz /path/to/src/file /path/to/dst/dir 你也可以用焦油 cd /path/to/src/
curl -o /path/to/destination file:///path/to/source/file
这将把
/path/to/source/file
复制到/path/to/destination
您可以使用rsync
rsync -avz /path/to/src/file /path/to/dst/dir
你也可以用焦油
cd /path/to/src/dir; tar -cpf - sourcefile | (cd /path/to/dest/dir; tar -xpf -)
如果您的tar支持-C
cd /path/to/src/dir; tar -cpf - sourcefile | tar -xpf - -C /path/to/dest/dir
很确定两年后你一点也不在乎,但我会避免
curl
,并使用cat
+基本shell重定向:cat sourceFile>targetFile
或curlfile:///path/to/source/file >/path/to/destination
使用普通shell重定向。