Something for me this time, makes a change. I have a four camera CCTV sytem on the house, burgled last year. I go through the nights recordings and save various things of interest going on around my house at night. Helped the Police on a couple of times.
When I do a backup of something, it gets saved into my C:\Cameas folder, and appears as a file such as 20120129_650152_camera03.mpg for a single one of four cameras or 20120129_650152_Quad.mpg for a group of four cameras in one image. The front part of the filename is date, followed by the time.
I need to have a database where it cycles through all the recordings, sees if it's already logged the date/time/type as a record, if not create a record for it, together with some link to include a bitmap.
The bit I am trying to find, is how do I physically go to the folder, loop though them, and get access to having the data in my hands to do the rest, ie split both types, see if already logged etc etc.
Something tells me using the filesystemobect is the way to start, would appreciate confirmation or advice. Thanks
Maybe Filesystemobject
-
- Administrator
- Posts: 78233
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Maybe Filesytemobject
Here is a bit of code to loop through all .mpg files in a folder:
Post back if you need more assistance.
Code: Select all
' Path including trailing backslash
Const strPath = "C:\Cameas\"
Dim strFile As String
' Find the first file
strFile = Dir(strPath & "*.mpg")
Do While strFile <> ""
' Do something with strPath and strFile here
...
' Find the next file
strFile = Dir
Loop
Best wishes,
Hans
Hans
-
- StarLounger
- Posts: 56
- Joined: 24 Jan 2012, 21:48
Re: Maybe Filesytemobject
Thank you very much again Hans, now I am on my way, perfect!!!
-
- Administrator
- Posts: 78233
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Maybe Filesytemobject
Keep in mind that the variable strFile will only contain the filename, not the path, so if you need to create a hyperlink or similar, you will need to use
strPath & strFile
to get the full path+filename.
strPath & strFile
to get the full path+filename.
Best wishes,
Hans
Hans
-
- StarLounger
- Posts: 56
- Joined: 24 Jan 2012, 21:48
Re: Maybe Filesystemobject
Thankyou Hans, I will keep that bit for future reference, as all the files are in one folder on the drive, easily typed in as a fixed path.