In my work environment, Screen capture and taking screenshots is a common thing to share the completed status. Ubuntu has the feature of screen capture in three ways:
PrtScr will capture the entire screen and will save it to Pictures
Shift + PrtScn will capture part of the screen my making the cursor to a plus sign (same as cmd + shift + 4 in mac) and will the screen capture to Pictures.
Ctrl + Shift + PrtScr will save the screen selection to clipboard.
The Problem
The first two options save captured images to the local Pictures folder. which is good, but image name will be like this Screenshot from 2019-10-30 06-45-37.png , after a while you lose track of dates and Pictures folder will just be a mess of Screenshot from lying around without any info.
Solution
Simple bash scripting and automating it with crontab for a particular time everyday solved this. First of all, I wanted to organise all the screenshots based on date, like every screenshot will be placed in a folder based on the date it was taken.
I’ve placed this in crontab to run every 12 hours.
Screenshots taken everyday will be a new folder and all the images of the particular date will be transferred to the respective folder. This leads to large number of folders every month. For minimalism, we can just organise these folders further to that particular month, compress them to a tar file and store them.
This small snippets searches for Screenshots according to month, creates a folder, compresses the folder after moving all the dates of the month to that particular folder.
Top comments (0)