My AXIS camera  (AXIS M1011-W Network Camera) captures files into files that look like this:

There are thousands of these images. The issue with lots of files of any type is that it takes forever to explore thru because Windows Explorer (or any file explorer for that matter), issue comes up with thosands of files and folders. I want them all organized into a date/hour folder format for easier and quicker viewing. So that I can easily navigate to the date and hour and look for the images.

The settings that I have for the events that get recorded are setup like this (the important setting that changes the file name is the Base file name which I have set to i.jpg, thats why my files start with i. Then the Add date/time suffix option need to be checked so that we get the proper date format of <base file><2 digit year>-<2 digit month>-<2 digit day>_<2 digit hour>-<2 digit minute>-<2 digit second>-<hundredth of second>.<extension of base file, which is jpg>). You get to this setup menu after you your servers (where you want the images saved to), when you setup the event type (the type of events that you want recorded & you select which server they are saved to & using which format like FTP & the file format – base file name and whether or not you want to add the date/time suffix). This is located in the WEB GUI under Setup in the Events tab, Event Types sub tab, when you create or modify an event.

Please read the comments in this script to see how to use it.

NOTE: this can be used to organize any files that have the format xYY-dd-mm_HH-MM-SSy. Where ‘x’ is any number of ascii chars that are not numbers – ‘x’ could be blank (in example below x is the character ‘i’, ‘YY’ is 2 digit year, ‘dd’ is 2 digit day, ‘mm’ is 2 digit month, ‘HH’ is 2 digit hour, ‘MM’ is 2 digit minute, ‘SS’ is 2 digit second, ‘y’ is the suffix which usually contains another time unit and an extension (.jpeg). At a minimum you are required to contain this xYY-dd-mm_HH. Files that will work (only need the minimum): i15-07-24_00-50-11-70.jpg, i15-07-24_00-50-11-70, da15-07-24_00-50-11, abc15-07-24_00-1.txt, 15-07-24_00-1.txt”

The script:

SIDENOTE: you can rerun the scripts it will not reorganize files that have already been organized. It only looks at the files in the root of the directory you point orgcam.sh to.

SIDENOTE: If you have your different cameras or events saving to different folders like this /data/Camera/cam1,/data/Camera/cam2 and etc… Inside the cam1 and cam2 files is where the images are. You can use a wrapper script that basically just runs orgcam.sh against the first layer of subfolder. so it will run orgcam.sh first at cam1 and then at cam2 (and the end result organized files will be in their respectable cam1 or cam2 folder -in other words it will not mix cam2 files into cam1 folders). Then you can set that script to run daily with your cron job.

The End.

Leave a Reply

Your email address will not be published. Required fields are marked *