1. Date attribute of a file

Is there any way with Euphoria that I can write read a file, modify it, 
and write it back *without* changing the date?

-- 
Craig

new topic     » topic index » view message » categorize

2. Re: Date attribute of a file

Craig Welch wrote:

> Is there any way with Euphoria that I can write read a file, modify it, 
> and write it back *without* changing the date?

You'll have to save the "time stamp" of the concerning file before writing to
it, and at the end that time stamp must be restored.
This can't be done with built-in Euphoria routines, but you can use the
concerning API functions of the operating system. If you are using Windows,
look at this program:
<http://www.rapideuphoria.com/cgi-bin/asearch.exu?win=on&keywords=filedt.zip>

Regards,
   Juergen

new topic     » goto parent     » topic index » view message » categorize

3. Re: Date attribute of a file

Juergen Luethje wrote:
> 
> Craig Welch wrote:
> 
> > Is there any way with Euphoria that I can write read a file, modify it, 
> > and write it back *without* changing the date?
> 
> You'll have to save the "time stamp" of the concerning file before writing to
> it, and at the end that time stamp must be restored.
> This can't be done with built-in Euphoria routines, but you can use the
> concerning API functions of the operating system. If you are using Windows,
> look at this program:
> <<a
> href="http://www.rapideuphoria.com/cgi-bin/asearch.exu?win=on&keywords=filedt.zip">http://www.rapideuphoria.com/cgi-bin/asearch.exu?win=on&keywords=filedt.zip</a>>
> 
> Regards,
>    Juergen

I'm curious as to why you would need to do this.  I've found that using time
stamps can efficiantly answer many questions when debugging a complex app under
development.  Malicious intent?  Why should the time stamp matter?

-- Brian

new topic     » goto parent     » topic index » view message » categorize

4. Re: Date attribute of a file

Brian Broker wrote:

> Juergen Luethje wrote:
>> 
>> Craig Welch wrote:
>> 
>>> Is there any way with Euphoria that I can write read a file, modify it, 
>>> and write it back *without* changing the date?
>> 
>> You'll have to save the "time stamp" of the concerning file before writing to
>> it, and at the end that time stamp must be restored.
>> This can't be done with built-in Euphoria routines, but you can use the
>> concerning API functions of the operating system. If you are using Windows,
>> look at this program:
>> <<a
>> href="http://www.rapideuphoria.com/cgi-bin/asearch.exu?win=on&keywords=filedt.zip">http://www.rapideuphoria.com/cgi-bin/asearch.exu?win=on&keywords=filedt.zip</a>>
>> 
>> Regards,
>>    Juergen
> 
> I'm curious as to why you would need to do this.  I've found that using time
> stamps can efficiantly answer many questions when debugging a complex app
> under
> development.  Malicious intent?  Why should the time stamp matter?
> 
> -- Brian

Of course I don't know why Craig wants to do this.

I myself often set the time stamp of a self-written program, when I've
finished a release version. When the program is say version 1.20, I'll
give it the time stamp
   <current date> 01:20:00

Regards,
   Juergen

new topic     » goto parent     » topic index » view message » categorize

5. Re: Date attribute of a file

Juergen Luethje wrote:

> Craig Welch wrote:
> 
>> Is there any way with Euphoria that I can write read a file, modify it, 
>> and write it back *without* changing the date?
> 
> You'll have to save the "time stamp" of the concerning file before writing to
> it, and at the end that time stamp must be restored.
> This can't be done with built-in Euphoria routines, but you can use the
> concerning API functions of the operating system. If you are using Windows,
> look at this program:
> <http://www.rapideuphoria.com/cgi-bin/asearch.exu?win=on&keywords=filedt.zip>

Thanks Juergen,

That gives me enough with which to proceed. I will use SetFileTime in a 
similar way. It's simple enough.

-- 
Craig

new topic     » goto parent     » topic index » view message » categorize

6. Re: Date attribute of a file

Brian Broker wrote:

>> Craig Welch wrote:
>>
>>> Is there any way with Euphoria that I can write read a file, modify it, 
>>> and write it back *without* changing the date?

> I'm curious as to why you would need to do this.  I've found that using time
> stamps can efficiantly answer many questions when debugging a complex app under
> development.  Malicious intent?  Why should the time stamp matter?

Malice? I'll let the insult slide, and answer your question directly ...

I have over 1,000 html files on my website. They are generated 
programatically. When I do a run it might change just a dozen or so pages.

The second last thing I do is run a program (Euphoria, of course!) that 
adds google analytics code to each page:

================================================
<script src="http://www.google-analytics.com/urchin.js" 
type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-715xxx-4";
urchinTracker();
</script>
================================================

That process changes the date of the file to today.

The last thing I do is run a program (Euphoria, of course!) that 
generates a google sitemap http://tinyurl.com/9a5nl. This program adds 
the *date of last change* of each web page.

At present, the latter program will put today's date to pages in the 
sitemap file (sitemap.xls) for pages that have been changed to add the 
analytics code, but have not had their *content* changed.

I want to run the 'add analytics code' program in such a way that the 
original page's date is left intact so that it doesn't give the wrong 
date to the sitemap program.

-- 
Craig

new topic     » goto parent     » topic index » view message » categorize

7. Re: Date attribute of a file

Craig Welch wrote:

<snip>

> I have over 1,000 html files on my website. They are generated 
> programatically. When I do a run it might change just a dozen or so pages.
> 
> The second last thing I do is run a program (Euphoria, of course!) that 
> adds google analytics code to each page:
> 
> ================================================
> <script src="<a
> href="http://www.google-analytics.com/urchin.js">http://www.google-analytics.com/urchin.js</a>"
>
> type="text/javascript">
> </script>
> <script type="text/javascript">
> _uacct = "UA-715xxx-4";
> urchinTracker();
> </script>
> ================================================

<snip>

Thanks for mentioning Google Analytics, I didn't know it before.
I visited their website, and it looks interesting.

Regards,
   Juergen

new topic     » goto parent     » topic index » view message » categorize

8. Re: Date attribute of a file

Juergen Luethje wrote:

> Thanks for mentioning Google Analytics, I didn't know it before.
> I visited their website, and it looks interesting.

It can be quite useful. Here's a snapshot of a report for one of my sites:

http://www.wazu.jp/airwork_analytics.jpg

-- 
Craig

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu