LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   access time change for directive (https://www.linuxquestions.org/questions/linux-general-1/access-time-change-for-directive-4175627511/)

suguprathap 04-12-2018 06:04 AM

access time change for directive
 
Hi,

i have a webserver document root as /var/www/html, inside that i have a folder called system. If i access the url http://test.system.com/system/hello.img in browser the access time of the file(hello.img) is changed but not the system folder. My requirement is when i access the file in a folder, the folder access time also has to be updated. I didn't find it in filesystem option. Your Help is much appreciated.

Regards,
Sugumar

Michael Uplawski 04-13-2018 04:35 AM

I may be erring and the effect of my suggestion may depend on the kind of server you are running.

But to do two things at the same time, i.e. serve (and touch) one file and at the same time touch the containing directory, you must concentrate both actions in 1 “command“. This calls for a programmed routine that your server must execute in lieu of simply serving the file.

I had hoped to find an automatism which can be triggered by the .htaccess file (apache-like web-servers) but this appears to be tricky, completely over my head, or downright impossible (all at once probably). Not fun, AFAIS.

scasey 04-13-2018 02:02 PM

On my system, the parent folder access time is updated when a file in the folder is created or changed. Simply reading a file does not affect the access time of the parent.

So, Michael Uplawski is on the right track...you may be able to effect what you want by touching or creating a file inside the system directory when the img file is retrieved...but like him, I'm not sure how you'd accomplish that upon request of a single file.

What is driving the requirement to see the access time of the containing folder changed?
Why are you looking at access times at all?
Have you looked into analyzing the log files to get what you need?


All times are GMT -5. The time now is 05:46 AM.