Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date Modified.

Status
Not open for further replies.

tar565

Programmer
Jan 24, 2005
39
IE
I am looking for a way to change the date modified of a file.

I have copied a file into a new folder and I have the date modified of the original file in a variable $DateModified

($DateModified) = (stat ($file1) )[9];

I now wish to change the modified date for $file2 to $DateModified.

 
If on *nix, use touch, or if on Doze look into cygwin, and *nix type implementation for windows, even the posix tools should be able to accomplish this, they should be available as part of the Resource Kit

HTH
--Paul

cigless ...
 
Have a look at this also:

Code:
($atime, $mtime) = (stat($file2))[8,9];
print "$file2 date modified is $mtime\n";

($atime, $mtime) = (stat($file1))[8,9];
print "$file1 date modified is $mtime\n";

utime($atime, $mtime, $file2);
$mtime = (stat ($file2) )[9];
print "$file2 date modified is now $mtime\n";

atime and mtime have to be called together.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top