Advertisements

In article <>,
<D.r Pickle> wrote:
: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...
--
*We* are now the times. -- Wim Wenders (WoD)

Advertisements

On Mon, 5 Apr 2004, Walter Roberson wrote:
> In article <>,
> <D.r Pickle> wrote:
> :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?

Share This Page

Welcome to The Coding Forums!

Welcome to the Coding Forums, the place to chat about anything related to programming and coding languages.

Please join our friendly community by clicking the button below - it only takes a few seconds and is totally free. You'll be able to ask questions about coding or chat with the community and help others.
Sign up now!