![]() |
Re: Change file creation date?
# This can be tested from the command line.$file2 should be an exact copy of
$file1 # with a current creation time. # NOTE: Other file statistics would also be changed. #--------------------------------------------------------------------------- ---------- $file1='C:/Perl/eg/temp/file1.html'; # put original files in temporary folder $file2='C:/Perl/eg/file1.html'; # copy new files to another directory unless(-e "$file2"){ #just a precaution use File::Copy; #method-use File::Copy; copy("$file1","$file2"); use File::Compare; #use File::Compare; if(compare("$file1","$file2")==0){ print"exact copy created\n"; } }else{ print"file already exists"; } #--------------------------------------------------------------------------- ---------- # cd C:\perl\eg # perl newsgroup.pl "jbl" <j.b.l.0.2.@.hotmail.com> wrote in message news:usbjs0lbadat35614r73qs5jmv9qlfu9eb@4ax.com... > I want to modify the file creation time to syncronize my local dates > with the dates on a server. > > I haven't found any way to do that yet > Using File::stat lets me read the file statistics for: > > meaning of the fields: > > 0 dev device number of filesystem > 1 ino inode number > 2 mode file mode (type and permissions) > 3 nlink number of (hard) links to the file > 4 uid numeric user ID of file's owner > 5 gid numeric group ID of file's owner > 6 rdev the device identifier (special files only) > 7 size total size of file, in bytes > 8 atime last access time since the epoch > 9 mtime last modify time since the epoch > 10 ctime inode change time (NOT creation time!) since the epoch > 11 blksize preferred block size for file system I/O > 12 blocks actual number of blocks allocated > > but I don't see creation date, > (ctime seems to be last change time) > and I only seem to be able to read these, not change them anyway. > > Thanls > jbl > |
Change file creation date?
I want to modify the file creation time to syncronize my local dates
with the dates on a server. I haven't found any way to do that yet Using File::stat lets me read the file statistics for: meaning of the fields: 0 dev device number of filesystem 1 ino inode number 2 mode file mode (type and permissions) 3 nlink number of (hard) links to the file 4 uid numeric user ID of file's owner 5 gid numeric group ID of file's owner 6 rdev the device identifier (special files only) 7 size total size of file, in bytes 8 atime last access time since the epoch 9 mtime last modify time since the epoch 10 ctime inode change time (NOT creation time!) since the epoch 11 blksize preferred block size for file system I/O 12 blocks actual number of blocks allocated but I don't see creation date, (ctime seems to be last change time) and I only seem to be able to read these, not change them anyway. Thanls jbl |
Re: Change file creation date?
jbl wrote:
> I want to modify the file creation time to syncronize my local dates > with the dates on a server. > > I haven't found any way to do that yet > Using File::stat lets me read the file statistics for: > > meaning of the fields: > > 0 dev device number of filesystem > 1 ino inode number > 2 mode file mode (type and permissions) > 3 nlink number of (hard) links to the file > 4 uid numeric user ID of file's owner > 5 gid numeric group ID of file's owner > 6 rdev the device identifier (special files only) > 7 size total size of file, in bytes > 8 atime last access time since the epoch > 9 mtime last modify time since the epoch > 10 ctime inode change time (NOT creation time!) since the epoch > 11 blksize preferred block size for file system I/O > 12 blocks actual number of blocks allocated > > but I don't see creation date, > (ctime seems to be last change time) > and I only seem to be able to read these, not change them anyway. > > Thanls > jbl > this is actually a FAQ: -------------------------------------------------------------------- 4.60: How can I always keep my hash sorted? You can look into using the DB_File module and tie() using the $DB_BTREE hash bindings as documented in "In Memory Databases" in DB_File. The Tie::IxHash module from CPAN might also be instructive. -------------------------------------------------------------------- |
Re: Change file creation date?
Ken wrote:
> this is actually a FAQ Hum, maybe that's not the answer to /all/ questions ;) scnr, Robert -- http://www.dunkelheit.at/ The mind is its own place, and in itself Can make a heaven of hell, a hell of heaven. -- Milton, »Paradise Lost« |
Re: Change file creation date?
jbl wrote:
> I want to modify the file creation time to syncronize my local dates > with the dates on a server. You can't. There's no such thing as "file creation time", at least not on a Windows or UNIX computer. The filesystem does not track such a statistic. -- Christopher Mattern "Which one you figure tracked us?" "The ugly one, sir." "...Could you be more specific?" |
Re: Change file creation date?
Chris Mattern wrote: > jbl wrote: > >>I want to modify the file creation time to syncronize my local dates >>with the dates on a server. > > You can't. There's no such thing as "file creation time", at least not > on a Windows or UNIX computer. The filesystem does not track such a > statistic. Er, NTFS5 does. (I think earlier NTFS did too). |
Re: Change file creation date?
Brian McCauley wrote:
> > > Chris Mattern wrote: > >> jbl wrote: >> >>>I want to modify the file creation time to syncronize my local dates >>>with the dates on a server. >> >> You can't. There's no such thing as "file creation time", at least not >> on a Windows or UNIX computer. The filesystem does not track such a >> statistic. > > Er, NTFS5 does. (I think earlier NTFS did too). Ah, well, my Windows knowledge is is weaker than my UNIX knowledge. So noted. -- Christopher Mattern "Which one you figure tracked us?" "The ugly one, sir." "...Could you be more specific?" |
Re: Change file creation date?
In article <cqcnu0$rp6$2@sun3.bham.ac.uk>,
Brian McCauley <nobull@mail.com> writes: >Chris Mattern wrote: >> You can't. There's no such thing as "file creation time", at least not >> on a Windows or UNIX computer. The filesystem does not track such a >> statistic. > >Er, NTFS5 does. (I think earlier NTFS did too). VMS too. (Excuse me, OpenVMS.) -- Peter Scott http://www.perldebugged.com/ *** NEW *** http://www.perlmedic.com/ |
Re: Change file creation date?
On Wed, 22 Dec 2004 17:06:20 -0500, Chris Mattern
<matternc@comcast.net> wrote: >Brian McCauley wrote: > >> >> >> Chris Mattern wrote: >> >>> jbl wrote: >>> >>>>I want to modify the file creation time to syncronize my local dates >>>>with the dates on a server. >>> >>> You can't. There's no such thing as "file creation time", at least not >>> on a Windows or UNIX computer. The filesystem does not track such a >>> statistic. >> >> Er, NTFS5 does. (I think earlier NTFS did too). > >Ah, well, my Windows knowledge is is weaker than my UNIX knowledge. >So noted. Thanks for the replies and help. I am using WindowsXP and I can see the file creation time. I was wanting to use the creation date as it is not volatile, like the last accessed time or modified time Thanks jbl |
| All times are GMT. The time now is 09:24 AM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.