tar打包且排除某個檔案
有tar打包,有時候需要排除某個檔案,本文件提供兩種方法來操作。 |
方法一
[root@system1 testdir]# touch 1 2 3 4 5 6 7 b [root@system1 testdir]# ls 1 2 3 4 5 6 7 b [root@system1 testdir]# tar zcvf a.tar.gz ./* --exclude b #排除b檔案 ./1 ./2 ./3 ./4 ./5 ./6 ./7 [root@system1 testdir]# ls 1 2 3 4 5 6 7 a.tar.gz b [root@system1 testdir]# mv a.tar.gz /tmp/test [root@system1 testdir]# ls 1 2 3 4 5 6 7 b [root@system1 testdir]# cd .. [root@system1 tmp]# cd test [root@system1 test]# ls a.tar.gz [root@system1 test]# tar -xvf a.tar.gz ./1 ./2 ./3 ./4 ./5 ./6 ./7 [root@system1 test]# ls 1 2 3 4 5 6 7 a.tar.gz
方法二
[root@system1 testdir]# ls 1 2 3 4 5 6 7 b [root@system1 testdir]# find ./ -type f ! -name 'b' | xargs tar caf a.tar.gz #排除b檔案 [root@system1 testdir]# ls 1 2 3 4 5 6 7 a.tar.gz b [root@system1 testdir]# mv a.tar.gz /tmp/test [root@system1 testdir]# cd /tmp/test [root@system1 test]# ls a.tar.gz [root@system1 test]# tar -xvf a.tar.gz ./1 ./2 ./3 ./4 ./5 ./6 ./7 [root@system1 test]# ls 1 2 3 4 5 6 7 a.tar.gz
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/31559985/viewspace-2637257/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- [轉帖]Linux tar壓縮命令 排除某個目錄 && 排除某種格式字尾檔案Linux
- Linux tar壓縮時排除某個目錄或檔案的引數Linux
- 使用tar打包,如何排除某些資料夾呢?
- AIX上打包排除某些檔案/資料夾AI
- Linux tar命令exclude選項排除指定檔案或目錄Linux
- rsync排除多個檔案同步
- maven打包時過濾檔案及排除依賴包Maven
- linux的tar命令詳情;linux多個檔案壓縮打包到一個壓縮檔案Linux
- SVN檔案排除
- ajax 請求某個檔案
- Gradle排除依賴模組的某個類Gradle
- 搜尋檔案下包含某個字串的檔案字串
- rm命令刪除檔案時排除特定檔案
- 要找出某個檔案中所有包含數字,且數字大於1000的行
- Linux 刪除除了某個檔案之外的所有檔案Linux
- iOS 打包.a檔案iOS
- jar檔案打包JAR
- 打包ipa檔案
- 用tar進行分卷打包(轉)
- 在多個檔案中import同一個檔案,webpack會多次打包嗎ImportWeb
- 怎樣阻止ICloud同步某個指定檔案Cloud
- 取SVN過去的某個版本檔案
- git的gitignore檔案排除資料夾和檔案Git
- 某檔案切割工具
- Linux命令 tar 打包解壓縮Linux
- git 檔案打包命令Git
- 解壓tar包中的指定檔案
- 檢視某個檔案屬於哪個RPM包
- android,如果某個檔案存在就刪除Android
- 某個控制檔案損壞的恢復案例
- 某Q友問題-如何在windows環境ftp檔案到ftp server並且重新命名上傳檔案WindowsFTPServer
- [Linux shell]查詢某目錄下檔案是否包含某個字串Linux字串
- webpack4配置(1)-打包一個js檔案WebJS
- 某個資料檔案損壞完全恢復(三)
- git刪除歷史中的某個大檔案Git
- webpack打包bundle檔案解析Web
- 如果報錯資訊說是無法刪除某個資料夾裡面的某個檔案
- VUE打包後配置配置檔案修改請求url方法及webpack打包的檔案生成同名檔案方法VueWeb