[英]After extracting files with 7zip how can you rename those file and save
[英]7zip: can't compress directories from text file, “WARNING: No more files”
我在家用和辦公計算機上對目錄進行了區分,並得到了我在家但不在工作的目錄列表:
comm -23 <(ls home_dir) <(ssh login@address ls work_dir) >missing
然后,我編輯了missing
的文件,使其變得像這樣:
"dir1" "dir2" "dir3" .....
然后我嘗試用7zip
壓縮丟失的目錄:
7z a missing.7z $(cat missing)
但是我收到一條錯誤消息:
Scanning the drive:
WARNING: No more files
"dir1"
WARNING: No more files
"dir2"
WARNING: No more files
"dir3"
.............
當我將目錄列表粘貼到7zip
命令時:
7z a missing.7z "dir1" "dir2" "dir3" ......
一切都很好。
為什么無法從文件中獲取目錄列表?
如果從文件中刪除引號,則命令將起作用。 我不知道為什么會這樣,但是我認為這與參數的傳遞方式有關。 我認為"dir1"
實際上是發送的,這就是7z抱怨的地方。
如果文件名或目錄中有空格,建議使用以下代碼。 您將必須更改“丟失”文件,以使目錄或文件用換行符分隔。
#! /bin/bash
archive=test.7z
while read -r line; do 7z a ${archive} "$line"; done < "missing"
dir1
dir2
dir 4
我無法與7z
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.