Getting the "Last modified" folder value to change further up the hierarchy.

G

Guest

I need the date of folder modification to effect the folders more than one level up.

IE.

When a file is added to

/main/subdir1/subdir2/
I want the "Last modified" dates of /main/ and /subdir1/ to also be updated.

Is there any easy way to do this?
Or does anyone know of some perl code that could take a full length path string and touch each of the dirs in it?

I'm really stumped here.
 
W

Walter Roberson

:I need the date of folder modification to effect the folders more than one level up.

:IE.

:When a file is added to

:/main/subdir1/subdir2/
:I want the "Last modified" dates of /main/ and /subdir1/ to also be updated.

:Is there any easy way to do this?

That is not in accordance with the POSIX standards. That leaves you
with a series of choices:

1) Modify your kernel filesystem to be non-POSIX compliant (possibly
breaking many other things in the process)

2) Use a "file alteration monitor" facility to watch all areas of interest
and change the modification times as per your specifications;

3) Re-design your code so that you do not have that requirement, such
as by coding yourself up a "last_modified_recursive" function that will
dig down recursively for the information you require (watch out for
symbolic links!)


:Or does anyone know of some perl code that could take a full length path string and touch each of the dirs in it?

Not generally, no. You do realize that the directory '/' is part of
the path /main/subdir1/subdir2/ and thus you are asking for the change
time on / to be updated every time any file anywhere on the system is
modified? You probably don't own '/' though, so your code would have to
run as root.

What, by the way, do you expect to have happen in the case of symbolic
links? If /main/subdir3/foo is a symbolic link to /main/subdir1/subdir2/bar
then when 'bar' changes, should the modification time on 'subdir3'
change as well, seeing as there is a path through subdir3 that has
a modified file? Then there are symbolic links to directories...
 
P

Paul Lalli

:I need the date of folder modification to effect the folders more than one level up.

:IE.

:When a file is added to

:/main/subdir1/subdir2/
:I want the "Last modified" dates of /main/ and /subdir1/ to also be updated.

:Is there any easy way to do this?

:Or does anyone know of some perl code that could take a full length path string and touch each of the dirs in it?

Not generally, no. You do realize that the directory '/' is part of
the path /main/subdir1/subdir2/ and thus you are asking for the change
time on / to be updated every time any file anywhere on the system is
modified? You probably don't own '/' though, so your code would have to
run as root.

The fact that the OP refers to directories as "folders" rather strongly
suggests he's running some flavor of Windows, doesn't it?

Paul Lalli
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,565
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top