compare last date modified with latest date in a folder

Reply
Trusted Advisor
Posts: 1,131

compare last date modified with latest date in a folder

Dear Experts,

I have a thought to check if the folder is updated or not , I mean like consider that there is a folder where we have the datasets and in this folder the datasets are regularly updated. Now is there a way we could check if the folder is updated even if a single dataset is updated and we get to know that its updated.

what i was thinking is we could set up a cron job for the same which runs regularly and sends an email to user when the folder is updated. However i am unable to understand how could I compare the old dates with updated datasets dates. I was think to compare the modified dates but how could I make the old dates stored in a memory  so that I could check the modified dates.

could you please let me know your thoughts or suggestions on the same. So I could program.

Thanks,
Jag
Super User
Posts: 17,912

Re: compare last date modified with latest date in a folder

It could be as simple as storing the last modified date in a master table somewhere. A SAS dataset or a text file in the folder are options to store the date. Then the job can compare to that date. 

Respected Advisor
Posts: 3,900

Re: compare last date modified with latest date in a folder

[ Edited ]

And just as an addendum to what Reeza wrote: And you would of course have to store this control table containing the last modified folder date in a different folder as else any update to the control table would change the modified date of the folder you check.

 

If this is about running some process when something in your directory changes, then - depending on your Unix system or scheduler available - there might also be options where you can have a trigger on files and/or folders where the process gets executed "on change". http://superuser.com/questions/363511/execute-script-program-when-file-changes

 

You will have to investigate what's available for your specific environment.

 

Super User
Posts: 9,687

Re: compare last date modified with latest date in a folder



filename x '/folders/myfolders/sas/';
filename y '/folders/myfolders/sas/text.txt';
proc sql;
create table want as
select *
 from dictionary.extfiles;
quit;

Ask a Question
Discussion stats
  • 3 replies
  • 170 views
  • 0 likes
  • 4 in conversation