Create Virtual Folder from find result

Questions about other topics - please check if your question fits better in another category before posting here
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
sebbo
Level 2
Level 2
Posts: 64
Joined: Wed Mar 18, 2015 5:00 am
Location: DE

Create Virtual Folder from find result

Post by sebbo »

Hi there,

i was looking for a way to turn a find result into a kind of virtual folder.

One example use case is, that the Photos that i take during my travel is scattered into various folders like

~/Pictures/2018/01_travel_to_somewhere/Lumix
~/Pictures/2018/01_travel_to_somewhere/Phone
~/Pictures/2018/01_travel_to_somewhere/Nikon

I would love to have a folder that contains the results for

~/Pictures: find . -newermt "$(date --date="2 days ago" +"%Y-%m-%d" )"

If i could have this as a virtual folder, i could easily use whatever slideshow software to show these pictures without any big preparation time...

This is just one use case, i guess there are plenty. E.g. for Backup purposes etc. (okay, for regular backups you will rather script something...).
Maybe another use case is if you could create a samba-share of this folder and share new Photos with your family easily.

Somebody knows a software that allows something like this?

Thanks +br
sebastian
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
chrisuk

Re: Create Virtual Folder from find result

Post by chrisuk »

I don't think this is what you want, but...

As a test; create a folder named dest in your Home folder, then type this into the terminal find ~/ -type f -name "*.txt" | xargs -i cp --parents "{}" dest.

It will find all *.txt files in your Home and copy them to the dest folder reproducing the folder structure.

Like I said, probably not what you wanted ;)
sebbo
Level 2
Level 2
Posts: 64
Joined: Wed Mar 18, 2015 5:00 am
Location: DE

Re: Create Virtual Folder from find result

Post by sebbo »

Thanks!

But apparently - as you already noticed - not exactly what i wanted.

But i will remember it for other use cases - so thanks anyway! :)
User avatar
greerd
Level 6
Level 6
Posts: 1060
Joined: Sat Jul 31, 2010 10:58 am
Location: Nova Scotia, Canada

Re: Create Virtual Folder from find result

Post by greerd »

You might be able to use exiftool to do something like that based on exif data, it wouldn't be a virtual folder but you could scan all you ~/Pictures and copy them to another sub-directory sorted by Y/M/D (or whatever) therefore combining all your different camera's pictures into common directories. Then just delete them after.

Code: Select all

sudo apt install libimage-exiftool-perl
then man exiftool for more info.
sebbo
Level 2
Level 2
Posts: 64
Joined: Wed Mar 18, 2015 5:00 am
Location: DE

Re: Create Virtual Folder from find result

Post by sebbo »

greerd wrote:You might be able to use exiftool(...)
Thanks for your input!

However, Photos was just one usecase. I was looking for something generic.

I have thought this over last night and i think it might be possible to have some script that does the search and then turn the search result absolute paths into symlinks.
This way there is no copying and deleting necessary. If i look at the photo use case it might be easily 5GB of photos that match the criteria that then need to be copied (which would not make my SSD live longer...)

The script could run in background triggered by a cronjob - depending on how up to date this must be like every 10 minutes or daily or anything in between.

Maybe i'm having a look if i can solve this puzzle with my mediocre coding skills any time soon. Of course i'll post an update here as soon as it is working - but don't have to high expectations please! :lol:
After all it is something which i call "luxury problem"... nice to have a solution for this, but can live without - and did so for multiple years. I was inspired by MiniDLNA which has a function to list the recent added Media.
Locked

Return to “Other topics”