【发布时间】:2016-08-30 11:07:25
【问题描述】:
我想知道是否可以在不覆盖不同文件夹中的同名文件的情况下提取子文件夹、zip 和 rars 中的文件。
示例文件夹:
TargetFolder
|
|
-- FolderOne
|
--- PDF.PDF
--- ZIP.ZIP <- FileInsideZIP.docx
|
-- FolderTwo
|
--- PDF.PDF
--- NestedFolder
|
--- SomeFile.txt
--- OtherFile.xls
期望输出:
FinalFolder
|--- PDF.PDF
|--- FileInsideZip.docx
|--- PDF (2).PDF
|--- SomeFile.txt
|--- OtherFile.xls
目前我正在使用以下命令行:
find TargetFolder -type f -exec cp --backup=numbered \{\} FinalFolder \;
这很好,但不幸的是,此命令不会获取 zip 中的文件,有时我在 zip 中包含 zip,等等。所以,我需要一个更好的方法,因为目前我正在浪费时间。
谢谢。
【问题讨论】:
标签: linux bash file command command-line-interface