Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

i have 4 folder hierarchy in a following format :

Hourly Daily Weekly Monthly.

In every folder i have files which is coming in a frequency based on their folder's name.

Now , i have to check hourly , daily, weekly and monthly whether latest file has been present in respective folder and if it is then put a mark in my Frequency table that it is present.

For an example , if i have a folder name 'Monthly' and my file is coming on 1 of every month at 5 PM , then the code should check at that particular time only.

As per my research ,this cant be implement through Triggers . Can anyone advice me how should i do this ?

share|improve this question

closed as off topic by RolandoMySQLDBA, Mark Storey-Smith, StanleyJohns, JNK May 17 '13 at 20:28

Questions on Database Administrators Stack Exchange are expected to relate to database administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

up vote 0 down vote accepted

Why would you want to use the DB to check for files ?

Just write a shell script (if using Linux) or bat script (Windows) to check for the files, and use cron or Windows task scheduler to run that script.

You can also create the INSERT query in the script (on Linux + MySQL that should be easy enough), and every time the files are checked, a new row should be inserted in your Frequency table.

Don't try to use the DB for something that can be easily done at OS level.

Just for fun, and the sake of your question, if are using MySQL, this would be a stupid hack to check if the hourly file has been received on the server:

  • Change the mysql location for importing dump files (SHOW VARIABLES LIKE 'data%) to be the folder where your hourly file should be

  • Create a stored procedure that can import data into a table, that uses ..LOAD DATA INFILE...

  • In the procedure code check the error codes Mysql will return when trying to import dump data from a dummy file -> There should be ERROR X for "file not found" and ERROR Y for "cannot insert that nasty data into the table". If the error is ERROR X, then the file is not there -> take another action.

But again, "don't try this at home !"

If you need help with the shell script, just let me know.

share|improve this answer
thanks..i will call u. – user21546 May 20 '13 at 8:02

Not the answer you're looking for? Browse other questions tagged or ask your own question.