Sunday, September 24, 2023
 Popular · Latest · Hot · Upcoming
3
rated 0 times [  3] [ 0]  / answers: 1 / hits: 2271  / 2 Years ago, fri, october 22, 2021, 12:40:09

I want to have a path in the filesystem that shows the entire contents of some other path, excluding a few certain files of my choosing. For example, if the following already exists,



original-path
├── file1
├── file2
├── file3
├── file4
├── folder1
│   ├── file1
│   └── file2
└── folder2
├── file1
└── file2


I want to be able to exclude /file1, /folder1/file1, and /folder2 from a new path that otherwise points to the same data:



new-path
├── file2
├── file3
├── file4
└── folder1
    └── file2


How can I accomplish this? Some kind of bind mount, FUSE filesystem, or clever linking scheme?


More From » filesystem

 Answers
1

rofs-filtered, a FUSE filesystem derived from Read-Only Filesystem, can exclude files using regular expressions:



$ cat rofs-filtered.rc 
^/file1$
^/folder1/file1$
^/folder2$
$ rofs-filtered -c /home/ak/sandbox/rofs-filtered.rc /home/ak/sandbox/original-path /home/ak/sandbox/new-path
$ tree {original,new}-path
original-path
├── file1
├── file2
├── file3
├── file4
├── folder1
│   ├── file1
│   └── file2
└── folder2
├── file1
└── file2
new-path
├── file2
├── file3
├── file4
└── folder1
└── file2


rofs-filtered isn't available in Ubuntu's repositories, but I've started a request to have it added.


[#44999] Saturday, October 23, 2021, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ronicod

Total Points: 71
Total Questions: 111
Total Answers: 111

Location: Montenegro
Member since Fri, Dec 10, 2021
2 Years ago
ronicod questions
Wed, May 17, 23, 02:25, 5 Months ago
Thu, Nov 11, 21, 06:26, 2 Years ago
Sun, May 7, 23, 13:57, 5 Months ago
Sun, Jun 26, 22, 06:13, 1 Year ago
Fri, Oct 14, 22, 13:55, 1 Year ago
;