Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Getting the "Last modified" folder value to change further up the hierarchy.

Reply
Thread Tools

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

 
 
Guest
Posts: n/a
 
      04-05-2004
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


 
Reply With Quote
 
 
 
 
Walter Roberson
Guest
Posts: n/a
 
      04-05-2004
In article <(E-Mail Removed) eed.com>,
<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)
 
Reply With Quote
 
 
 
 
Paul Lalli
Guest
Posts: n/a
 
      04-05-2004
On Mon, 5 Apr 2004, Walter Roberson wrote:

> In article <(E-Mail Removed) eed.com>,
> <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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
A Paradise DNS address change? What change? There was no change. Tony Neville NZ Computing 7 09-22-2006 01:02 PM
I am getting a little further, but still having issues... Brent White ASP .Net 8 10-26-2005 06:04 PM
Further my Cisco Career Casey Cisco 3 10-13-2005 05:03 AM
Stopping further processing with an Exit Sub in the Page_Load Event not working. Jason ASP .Net 2 06-10-2004 01:36 PM
Go further....?!? New Comer of MCAD.NET MCSD 3 11-21-2003 01:33 AM



Advertisments