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

Discussion in 'Perl Misc' started by Guest, Apr 5, 2004.

  1. Guest

    Guest 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.


    ----------------------------
    Red Hat Linux 8.0
    Guest, Apr 5, 2004
    #1
    1. Advertising

  2. 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)
    Walter Roberson, Apr 5, 2004
    #2
    1. Advertising

  3. Guest

    Paul Lalli Guest

    Re: Getting the "Last modified" folder value to change further upthe hierarchy.

    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?

    Paul Lalli
    Paul Lalli, Apr 5, 2004
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rich Pasco
    Replies:
    2
    Views:
    19,303
    Rich Pasco
    Oct 9, 2003
  2. Brent White
    Replies:
    8
    Views:
    614
    S. Justin Gengo
    Oct 26, 2005
  3. Dennis Marks

    Last Modified Date

    Dennis Marks, May 2, 2004, in forum: HTML
    Replies:
    9
    Views:
    708
    Thomas 'PointedEars' Lahn
    May 21, 2004
  4. Jeff Thies

    Last Modified

    Jeff Thies, Aug 13, 2004, in forum: HTML
    Replies:
    6
    Views:
    738
    Jukka K. Korpela
    Aug 13, 2004
  5. Replies:
    3
    Views:
    309
    Fredrik Lundh
    Oct 30, 2006
Loading...

Share This Page