仅搜索目录的文件 [英] Tarring only the files of a directory
问题描述
如果我有一个包含一堆图像的文件夹,我如何才能只打开图像而不是文件夹结构导致图像,而无需将CD插入图像目录中?
tar czf images.tgz / path / to / images / *
现在当提取images.tgz时,提取的内容是/ path /到/ images /...
我如何只能将图像包含到tgz文件中(而不是导向图像的三个文件夹)?
我知道你可以使用 - strip-components
也许遍历一个文件夹结构,然后通过stdout / stdin将结果管道到tar顺序? (与 cat
或类似?)IANA Linux专家所以害怕我只能理论,而提供硬代码在这秒,你有我想知道现在虽然...
If I have a folder with a bunch of images, how can I tar ONLY the images and not the folder structure leading to the images without having to CD into the directory of images?
tar czf images.tgz /path/to/images/*
Now when images.tgz is extracted, the contents that are extracted are /path/to/images/...
How I can only have the images included into the tgz file (and not the three folders that lead to the images)?
I know you can use --strip-components
when untarring although I'm not sure if this would also work when creating.
Perhaps iterate through a folder structure and then pipe the results via stdout/stdin to tar sequentially? (with cat
or similar?) IANA Linux Expert so afraid I can only theorise versus provide hard code at this second, you've got me wondering now though...
这篇关于仅搜索目录的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!