3

Is it possible to create a "file" that, essentially, is symlinked to multiple other files.

Let's say we have a /tmp/dir/ with 100 files in it. What I want is to be able to do is "cat /tmp/dir_allfiles" which would, in essence, be the same as cat /tmp/*

The real use case is more complicated where files may be at different directory levels, etc. so please don't suggest I just use find or cat */*/* or something similar.

I'm fine if I have to use C to do ridiculous / dangerous things. I'm mostly interested in if it's possible.

Here's some of my uname -a if you are curious 3.13.0-32-generic #57-Ubuntu SMP Tue Jul 15 03:51:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

2 Answers 2

3

That is definitely possible to do at the VFS level, e.g. using FUSE.

In particular, concat-fuse, looks pretty much like what you need:

concat-fuse is a FUSE based virtual filesystem for Linux that allows handling a collection of files as if they were a single one. It is essentially doing:

cat *.txt > large_file

But instead of creating large_file, it creates a virtual file and accesses the original *.txt files instead.

0

Could you not do something similar in a subshell?

cat <( cat */foo/*; cat */bar/*/baz; )

find is phenomenally powerful, please explain a little more detail about what you're trying to accomplish as there may be a much more simple answer.

1
  • Mostly I am curious if it's simple possible to have a single file descriptor point to multiple other files. I realize that sub shells or find or any other approach is "better" or "correct" or "would work".
    – A Brothers
    Commented Feb 22, 2017 at 19:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .