shellscript tar問題 - Linux

By Susan
at 2021-07-31T07:54
at 2021-07-31T07:54
Table of Contents
最近公司丟一個寫Script的工作給我這個完全沒碰過的人....
是這樣的...
我在/home/ray/photo路徑下放了3個資料夾,分別是20210811、20210701跟20210715
而我想要把20210701跟20210715兩個資料夾打包放到/home/ray/photo2並命名為202107
我的寫法是
find /home/ray/photo -type d -name "202107*" -exec tar -czvPf /home/ray/photo2/202107.tar.gz "{}" \;
打包時會顯示兩個資料夾都有包進去
但是用tar -zxvf解開後只會解一個出來...
想問問看是哪裡出問題
另外想問問如何打包但不包含路徑
先感謝大家了
--
是這樣的...
我在/home/ray/photo路徑下放了3個資料夾,分別是20210811、20210701跟20210715
而我想要把20210701跟20210715兩個資料夾打包放到/home/ray/photo2並命名為202107
我的寫法是
find /home/ray/photo -type d -name "202107*" -exec tar -czvPf /home/ray/photo2/202107.tar.gz "{}" \;
打包時會顯示兩個資料夾都有包進去
但是用tar -zxvf解開後只會解一個出來...
想問問看是哪裡出問題
另外想問問如何打包但不包含路徑
先感謝大家了
--
Tags:
Linux
All Comments

By Zenobia
at 2021-08-04T23:59
at 2021-08-04T23:59

By Tracy
at 2021-08-07T02:20
at 2021-08-07T02:20

By Ophelia
at 2021-08-11T19:43
at 2021-08-11T19:43

By Una
at 2021-08-14T13:03
at 2021-08-14T13:03

By Carolina Franco
at 2021-08-15T13:38
at 2021-08-15T13:38

By Todd Johnson
at 2021-08-19T06:05
at 2021-08-19T06:05

By Madame
at 2021-08-21T05:48
at 2021-08-21T05:48

By Audriana
at 2021-08-23T15:17
at 2021-08-23T15:17

By Audriana
at 2021-08-27T17:08
at 2021-08-27T17:08

By Emily
at 2021-08-28T13:50
at 2021-08-28T13:50

By Charlie
at 2021-08-28T14:54
at 2021-08-28T14:54

By Freda
at 2021-09-01T07:42
at 2021-09-01T07:42
Related Posts
fcitx在chrome倒退會吃字

By Erin
at 2021-07-28T13:52
at 2021-07-28T13:52
抓不到麥克風問題

By Ina
at 2021-07-27T16:16
at 2021-07-27T16:16
Docker port 開不起來

By Heather
at 2021-07-25T20:41
at 2021-07-25T20:41
bash運算問題

By Adele
at 2021-07-24T05:28
at 2021-07-24T05:28
崑大資傳系「鳥哥」架Linux免費教學網 人氣破四千萬

By Charlie
at 2021-07-24T01:43
at 2021-07-24T01:43