如何在Linux上使用Suplash FS多次压缩不同的文件夹?
我尝试了那些没有成功的人:
for i in */; do mksquashfs "${i}" "${i}.squashfs" -comp xz
find . -name "*/" -exec mksquashfs {} {}.squashfs -comp xz \;
我在这里的对象是在位置上找到文件夹,并分别压缩它们,但没有一个一个一个。
原始代码:
mksquashfs Direcoty\ Name\ To\ Compress \1/ Direcoty\ Name\ To\ Compress \1.squashfs -comp xz
mksquashfs Direcoty\ Name\ To\ Compress \2/ Direcoty\ Name\ To\ Compress \2.squashfs -comp xz
mksquashfs Direcoty\ Name\ To\ Compress \3/ Direcoty\ Name\ To\ Compress \3.squashfs -comp xz
mksquashfs Direcoty\ Name\ To\ Compress \4/ Direcoty\ Name\ To\ Compress \4.squashfs -comp xz
mksquashfs Direcoty\ Name\ To\ Compress \5/ Direcoty\ Name\ To\ Compress \5.squashfs -comp xz
I have tried those without success:
for i in */; do mksquashfs "${i}" "${i}.squashfs" -comp xz
find . -name "*/" -exec mksquashfs {} {}.squashfs -comp xz \;
My object here, is find folders on the location, and compress them separately, but without doing it one by one.
Original code:
mksquashfs Direcoty\ Name\ To\ Compress \1/ Direcoty\ Name\ To\ Compress \1.squashfs -comp xz
mksquashfs Direcoty\ Name\ To\ Compress \2/ Direcoty\ Name\ To\ Compress \2.squashfs -comp xz
mksquashfs Direcoty\ Name\ To\ Compress \3/ Direcoty\ Name\ To\ Compress \3.squashfs -comp xz
mksquashfs Direcoty\ Name\ To\ Compress \4/ Direcoty\ Name\ To\ Compress \4.squashfs -comp xz
mksquashfs Direcoty\ Name\ To\ Compress \5/ Direcoty\ Name\ To\ Compress \5.squashfs -comp xz
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是更多的狂欢,找到用法而不是南瓜。
您在两次尝试中都犯了错误。
在此尝试中,您会忘记“* /”将扩展到带有尾随 /图像文件名,即
i =“ hello/”
$ {i} .squashfs = hello/.squashfs
您要么必须剥离尾随/,要么首先没有它。
这将
在查找案例中
查找会抱怨嵌入的“/”*/“”。此外,一旦固定发现将递归下降目录,并在所有内容上运行MKSquashf。您想将其限制在顶级和目录。
这将起作用
This is more Bash and Find usage rather than Squashfs.
You have made mistakes in both attempts.
In this attempt, you're forgetting that "*/" will expand to a filename with a trailing /, and this will be included in the Squashfs image filename, i.e.
i = "hello/"
${i}.squashfs = hello/.squashfs
You either have to strip the trailing /, or not have it there in the first place.
This will work
In the Find case
Find will complain about the embedded "/" in "*/". Additionally, once fixed find will recursively descend the directories, running Mksquashfs on everything. You want to limit it to the top level and directories.
This will work