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 please read how to get help
Post Reply
sebbo
Level 1
Level 1
Posts: 45
Joined: Wed Mar 18, 2015 5:00 am
Location: DE

Create Virtual Folder from find result

Post by sebbo » Fri Jan 26, 2018 3:50 am

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

User avatar
chrisuk
Level 5
Level 5
Posts: 593
Joined: Thu Jun 12, 2008 6:16 am

Re: Create Virtual Folder from find result

Post by chrisuk » Fri Jan 26, 2018 4:24 am

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 ;)
Chris

Manjaro MATE - MX Linux - LMDE MATE

sebbo
Level 1
Level 1
Posts: 45
Joined: Wed Mar 18, 2015 5:00 am
Location: DE

Re: Create Virtual Folder from find result

Post by sebbo » Fri Jan 26, 2018 5:13 am

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 5
Level 5
Posts: 984
Joined: Sat Jul 31, 2010 10:58 am
Location: Nova Scotia, Canada

Re: Create Virtual Folder from find result

Post by greerd » Fri Jan 26, 2018 2:44 pm

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 1
Level 1
Posts: 45
Joined: Wed Mar 18, 2015 5:00 am
Location: DE

Re: Create Virtual Folder from find result

Post by sebbo » Sat Jan 27, 2018 9:24 am

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.

Post Reply

Return to “Other topics”