: Inkscape: Automatically updating linked images to the newest one in a folder I've been using inkscape to compare a picture against a drawing in another editor. I do this by taking a screenshot
I've been using inkscape to compare a picture against a drawing in another editor. I do this by taking a screenshot of the editor and overlay that over the original image in inkscape. Going back and forth iterating the design. Taking a new screenshot at each step.
I found the best way to do this is to change the linked file path in inkscape. This got me wondering if it's possible to automate this, so that the path gets changed to the latest file in the folder?
EDIT#1 I dont have a way to just overwrite the old screenshot. I'm using dropboxs build in tool and there is no option to do that. I dont really want to install anything else just to do this, so alternative screengrabers are out. And doing it by hand renders the point moot.
More posts by @Ravi4787994
1 Comments
Sorted by latest first Latest Oldest Best
Here is my script:
$ cat link_latest.sh
#!/bin/bash
# TODO: probably good to cd to right directory first
LINK_NAME=latest_link.png # arbitrary
LATEST=$(ls -t | head -1) # stackoverflow.com/questions/5885934/bash-function-to-find-newest-file-matching-pattern
rm $LINK_NAME
ln -s $LATEST $LINK_NAME
As mentioned in the TODO you should make sure you are in the right directory before starting.
Here it is in action:
$ ls *.png *.svg | wc
69 69 2028
$ touch A68-Arrow-Gray-Right.svg
$ ./link_latest.sh
$ ls -l latest_link.png
lrwxrwxrwx 1 chicks chicks 24 Jan 1 06:50 latest_link.png -> A68-Arrow-Gray-Right.svg
$ touch A19-CircleArrow.png
$ ./link_latest.sh
$ ls -l latest_link.png
lrwxrwxrwx 1 chicks chicks 19 Jan 1 06:50 latest_link.png -> A19-CircleArrow.png
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.