壓縮檔是.zip
檔案有aaa202001.zip、aaa202002.zip、aaa202003.zip、bbb202003.zip
如果我只想解壓 aaa.zip,語法該怎麼寫?
unzip -o 'aaa.zip' ?
另外如果我只想解壓 aaa.zip 中序號最後的那個 -> aaa202003.zip
又該怎麼解?麻煩各位大神幫忙了*
解壓縮 aaa.zip : unzip aaa.zip
解壓縮 aaa202003.zip : unzip aaa202003.zip
sudo find ./ -name 'aaa*.zip' -maxdepth 1 -exec unzip {} -d /目標資料夾 \;
-maxdepth 1 不再往子目錄找下去
-exec unzip {} 把找到的檔名塞進{}裡,執行unzip與之後的指令
; -exec 指定指定的結尾
[09:07:46] ~/work/m2006/d0618
|=> touch aaa202001.zip
[09:08:39] ~/work/m2006/d0618
|=> touch aaa202002.zip
[09:08:41] ~/work/m2006/d0618
|=> touch aaa202003.zip
[09:08:45] ~/work/m2006/d0618
|=> ls aaa*.zip | sort
aaa202001.zip
aaa202002.zip
aaa202003.zip
[09:08:57] ~/work/m2006/d0618
|=> ls aaa*.zip | sort | head -1
aaa202001.zip
[09:09:04] ~/work/m2006/d0618
|=> ls aaa*.zip | sort -r | head -1
aaa202003.zip
然後自己再加工.