Is it possible to set the default directory for photos and videos made by Millipixels? I’m continuously struggling with a full disk on my Librem 5.
I would like to save photos and videos to the mounted SD-card directly.
Is it possible to set the default directory for photos and videos made by Millipixels? I’m continuously struggling with a full disk on my Librem 5.
I would like to save photos and videos to the mounted SD-card directly.
Not sure if you can change the dir, but if not you can set up a small script to move your files automatically.
- You can run a script periodically that takes all uploaded files and moves them to the specified target dir. For this you need to write a short shell script in bash, for example:
#!/bin/bash mv /home/user/UPLOADS/*.jpg /var/www/images/
(This script takes simply all files with the extension .jpg from directory /home/user/UPLOADS and puts them without further check to the directory /var/wwww/images )Place this script somewhere (eg. /home/user/bin/) and make it executable: chmod a+x /home/user/bin/SCRIPTNAME This script can be run periodically via cron, call crontab -e and write a new line like so:
*/5 * * * * /home/user/bin/SCRIPTNAME
that executes the script every 5 minutes.Drawback is that it is called every 5 minutes, so there might be a gap between upload and move of max 5 minutes. additionally, if the script runs WHILE uploading of new images, something strange might happen…
If that’s the only thing you want to do, one option would be to just have your Photos folder symlink to a folder on the SD card.
That’s what I do with my music at least, works fine.
Just keep in mind though, that the camera app will in that case not work if your SD card is not inserted.
What about using rsync
on a cron
? Set desired periodicity. And a scheduled “move to trash” from the hard drive. (Trashed files recoverable in case unwanted deletion occurs.)
I created this issue to request setting custom directories to save photos and videos in Millipixels.
Please note also the more longer conversation about folders, file naming and options in Camera development progress that is related to this issue/request - some good points were made about what may be needed (user selectable options for different filetypes that camera produces etc.).
I’ve added the following cron job:
0 * * * * cp -ru /home/purism/Pictures/* /media/purism/"Memory card"/Pictures/
This copies, every hour on the hour, the contents of the Pictures directory (internal storage) to a directory I’ve named “Pictures” on the memory card, avoiding creating duplicates.
Instead of moving the files, which would remove them from the internal storage, this way leaves me with the original and a copy, just in case. I can adjust the interval to something more frequent if I’m shooting a lot of photos at any given time, during a trip, for instance.
The .jpg files seem to size between 1 and 2 megabytes, and the accompanying .dng files at about 13 megabytes, so they don’t take up a lot of space. I can just do an occasional deletion of accumulated photos in internal storage after my backups are created.
EDIT: “Memory card” is how my microsd card displays in the file structure. A different card might show a different label.
I’ve put the µSD card into /etc/fstab
so that it mounts exactly where I want it. Just need to remember to use the nofail
option in the line that specifies the details for the mounting of the µSD card so that if the card is not there or otherwise gives a problem, the boot does not get messed up.