Modifying dates with REBOL
[1/6] from: mat::plothatching::com at: 25-Jan-2003 17:17
Folks,
I did something foolish a few days ago. I moved a whole pile of files
off a web server out of the content management system. Then moved them
back some days later. Unfortunately I forgot that the php on the web
server actually scans the file modified dates of those files to figure
out the newest and hence which should be displayed at the top of the
web page.
Now, the files on my hard drive have the correct date. Yet when I
upload them to the web server via FTP, the modified dates are reset to
today's date.
So it occurred to me that I could somehow alter the modified stamps via
ftp after scanning the time stamps off the local files with REBOL.
Yet... I can't seem to find any details in REBOL of modifying dates on
files, let alone via FTP.
Has anyone done this?
Regards,
Mat.
[2/6] from: sunandadh:aol at: 25-Jan-2003 13:31
Mat:
> Yet... I can't seem to find any details in REBOL of modifying dates on
> files, let alone via FTP.
Dunno if its the right answer, but take a look at get-modes and set-modes for
'file-modes in:
http://www.rebol.com/docs/core25.html
Sunanda
[3/6] from: greggirwin:mindspring at: 25-Jan-2003 12:47
Hi Mat,
MB> So it occurred to me that I could somehow alter the modified stamps via
MB> ftp after scanning the time stamps off the local files with REBOL.
MB> Yet... I can't seem to find any details in REBOL of modifying dates on
MB> files, let alone via FTP.
I don't think this will work over FTP, but it's a start for you.
touch: func [
{Set the modification timestamp of the file.}
files [file! block!] "The file, or files, you want to stamp"
time [date!] "The date and time to stamp them with"
/local rd-only
][
; We have to turn off the read-only attribute if it's on.
foreach item compose [(files)] [
rd-only: not get-modes item 'owner-write
set-modes to-file item [owner-write: true modification-date: time]
if rd-only [set-modes item [owner-write: false]]
]
]
-- Gregg
[4/6] from: james:mustard at: 26-Jan-2003 12:20
was just thinking.. in windows 2k and up cant you just map this as a virtual
drive (to the ftp site) and then have rebol treat it as a normal drive thus
making Gregg's code work fine? Anyone done this before? I know I use ftp's
as virtual drives for some dev work..
James.
Gregg wrote:
[5/6] from: mat:plothatching at: 26-Jan-2003 0:03
Hi James,
James> was just thinking.. in windows 2k and up cant you just map this as a virtual
James> drive (to the ftp site) and then have rebol treat it as a normal drive thus
James> making Gregg's code work fine? Anyone done this before? I know I use ftp's
James> as virtual drives for some dev work..
That's an idea. However at this point I have a serious suspicion that
you can't set dates with the FTP protocol. I've checked a few FTP
clients and none of them allow setting of dates on files, only
changing the flags and so on.
Regards,
Mat.
[6/6] from: chris:ross-gill at: 25-Jan-2003 19:32
Hi Mat,
> That's an idea. However at this point I have a serious suspicion that
> you can't set dates with the FTP protocol. I've checked a few FTP
> clients and none of them allow setting of dates on files, only
> changing the flags and so on.
Perhaps you could set up a CGI/server-side script to timestamp files and
invoke it from your local machine that has the correct filename/date
information...
- Chris