我尝试使用相对路径使用tar创建档案。我使用以下命令:
tar czf ~/files/wp/my-page-order.tar.gz -C ~/webapps/zers/wp-content/plugins/ ~/webapps/zers/wp-content/plugins/my-page-order
但是存档文件仍然具有绝对路径。如何在相对路径中使用tar?
~
由外壳扩展。不要~
与-C一起使用:
tar czf ~/files/wp/my-page-order.tar.gz \
-C ~ \
webapps/zers/wp-content/plugins/my-page-order
(tar将包含webapps/zers/wp-content/plugins/my-page-order
路径)或
tar czf ~/files/wp/my-page-order.tar.gz \
-C ~/webapps/zers/wp-content/plugins \
my-page-order
(tar将包含my-page-order
路径)
或者只是cd
第一...
cd ~/webapps/zers/wp-content/plugins
tar czf ~/files/wp/my-page-order.tar.gz my-page-order
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句