artem78 has asked for the wisdom of the Perl Monks concerning the following question:

utime function can change only access and modification date of file. How can I change create date in Windows?

Replies are listed 'Best First'.
Re: Change create file date
by haukex (Archbishop) on May 06, 2016 at 13:08 UTC

    Hi artem78,

    A quick search on CPAN reveals that Win32API::File::Time may be able to help you. From its synopsis:

    use Win32API::File::Time qw{:win}; ($atime, $mtime, $ctime) = GetFileTime ($filename); SetFileTime ($filename, $atime, $mtime, $ctime);

    Hope this helps,
    -- Hauke D

Re: Change create file date
by stevieb (Canon) on May 06, 2016 at 12:54 UTC

    I'm pretty sure you'll have to re-create the file. Here's one way:

    use warnings; use strict; use File::Copy; copy 'file.txt', 'file2.txt' or die $!; rename 'file2.txt', 'file.txt' or die $!;