ftp - How can I automatically rename, copy and delete files in linux for my ip camera webcam? -
ftp - How can I automatically rename, copy and delete files in linux for my ip camera webcam? -
i have ip photographic camera automatically ftps images every few seconds directory on linux ubuntu server web server. i'd create simple webcam page references static image , refreshes every few seconds. problem ipcamera's firmware automatically names every file date_time.jpg type filename, , not have alternative overwrite same file name on , over.
i'd have script running on linux machine automatically re-create new file has been ftp'd directory different directory, rename in process , delete original.
regards, glen
i made quick script, need uncomment rm -f line create delete things :)
it prints command have run, can test higher confidence.
you need set work_dir , dest_dir variables near top of script.
#!/bin/bash ######################### # configure vars yyyymmdd=`date +%y%m%d` work_dir=/users/neil/linuxfn dest_dir=/users/neil/linuxfn/dest_dir ########################## latest=`ls -tr $work_dir/$yyyymmdd* 2>/dev/null | tail -1` echo "rm -f $dest_dir/image.jpg ; mv $latest $dest_dir/image.jpg" #rm -f $dest_dir/image.jpg ; mv $latest $dest_dir/image.jpg
this give me next output when run on laptop:
mba1:linuxfn neil$ bash renamer.sh rm -f /users/neil/linuxfn/dest_dir/image.jpg ; mv /users/neil/linuxfn/20150411-2229 /users/neil/linuxfn/dest_dir/image.jpg
linux ftp webcam ip-camera
Comments
Post a Comment