Luup code for renaming a file as date and time

#1

HI,

Im trying to set up a scene to capture a image from my camera on a scene execution. So far I have managed to be able to pull the image with a os.execute but im unable to get it to rename.

My basic lua is :

os.execute(“wget http://192.168.0.18:9040/snapshot -P /root/nas1/foscam/”)
luup.call_delay(5)
os.execute(“mv snapshot $(date +%F-%H:%M).jpg”)

The mv command works in ssh as standard mv command but not in my scene? Can anyone help?

Thanks

John

0 Likes

#2

Sorry it works if I add full file path :slight_smile:

0 Likes

#3

There is also the native Lua routine [tt]os.rename()[/tt] that you could use in future.

0 Likes