代码之家  ›  专栏  ›  技术社区  ›  user2373210

Untar文件不到一天

  •  0
  • user2373210  · 技术社区  · 7 年前

    我有单独的解决方案,但试图将它们结合起来。

    find . -name 'BkupFPTCONS*' -mtime -1 | xargs tar -xvf
    

    tar -xf BkupFPTCRPOL*.tar.gz -C ./FPTCRPOL --strip-components=1 
    

    非常感谢您的建议。

    1 回复  |  直到 7 年前
        1
  •  1
  •   nbari    7 年前

    find . -name 'BkupFPTCONS*' -mtime -1 -execdir tar -xf {} -C ./FPTCRPOL --strip-components=1 \;
    

    注意 -execdir ,来自该男子:

    -execdir utility [argument ...] ;
             The -execdir primary is identical to the -exec primary with
             the exception that utility will be executed from the directory
             that holds the current file.  The filename substituted for 
             the string ``{}'' is not qualified.
    

    -delete

    find . -name 'BkupFPTCONS*' -mtime -1 \
        -execdir tar -xf {} -C ./FPTCRPOL --strip-components=1 \; -delete