File date
[1/5] from: louisaturk:coxinet at: 25-Oct-2002 1:30
Hi rebols,
How can I change the name of a file without changing its date?
Louis
[2/5] from: tomc:darkwing:uoregon at: 24-Oct-2002 23:52
in unix
% cp -p foo bar
will make an exact copy of foo including its date with the name bar
I don't know of another way (hmmm. resetting your system clock?)
On Fri, 25 Oct 2002, Louis A. Turk wrote:
[3/5] from: micael:gullmes:telenor:se at: 25-Oct-2002 9:52
Hi Louis,
the following (non tested) code should do the trick:
old_modes: get-modes %oldfile.txt [creation-date modification-date]
rename %newfile.txt %oldfile.txt
set-modes %newfile.txt old_modes
see http://www.rebol.com/docs/core25.html for more info on modes.
Brgds /Micael
-----Ursprungligt meddelande-----
Fr=E5n: Louis A. Turk [mailto:[louisaturk--coxinet--net]]
Skickat: den 25 oktober 2002 08:31
Till: [rebol-list--rebol--com]
=C4mne: [REBOL] File date
Hi rebols,
How can I change the name of a file without changing its date?
Louis
[4/5] from: louisaturk:coxinet at: 25-Oct-2002 8:35
Micael,
Your solution works beautifully. Many thanks! Thanks also to Tom,
although I am using w2k not Linux, so couldn't use his solution.
Louis
At 09:52 AM 10/25/2002 +0200, you wrote:
[5/5] from: louisaturk::coxinet::net at: 25-Oct-2002 9:17
REBOL [
Title: "change-name-not-date"
Date: 25-Oct-2002
Name: 'change
Version: 1.1.0 ; majorv.minorv.status
; status: 0 = unfinished; 1 = testing; 2 = stable
File: %change.r
Author: "Louis A. Turk"
Purpose: {Change the name of a file without changing its creation date
or other dates.}
Comment: {Thanks to Gullmes Micael for showing me how to do this.}
History: [
1.1.0 [25-Oct-2002 {} "lat"]
]
Example: {Run the program; answer the questions.}
]
forever [
print "^/This utility renames a file without changing its date.^/^/"
old-name: to-file ask "File to change: "
new-name: to-file ask "New name : "
old_modes: get-modes old-name [creation-date modification-date]
rename old-name new-name
set-modes new-name old_modes
]