After removing more than 1,000 videos I see my code does not remove the actual file from the server, only database references.
So now I have more than 1,000 videos on my server that shouldn't be there.
If I look at sample rows in my database for existing videos I can see the naming convention is like this:
Video Id: 13
Video url: videos/2006/145-13.wmv
thumbnail: videos/2006/145-13.jpg
As you can see the video id is stored in the video and thumb filenames.
I'm not exactly sure how to write code to disect filenames on my server, take out the number between the dash and the period and then check the database for the video id and if it doesn't exist delete the file on the server.
Can anyone point me in the right direction or provide a simple code sample? I don't imagine it should be too difficult.
Thank you in advance
Chris