({{, (RefLink[SetFileDate, paclet:ref/SetFileDate])["file"]
sets the modification and access dates for a file to be the current date. }})

OpenersNotesSection(Spacer1)Details

(RefLink[SetFileDate, paclet:ref/SetFileDate])["file",date] sets the modification and access dates to be the specified date.

The date can be given as a date object or in the date list format as obtained from (RefLink[DateList, paclet:ref/DateList]).

(RefLink[SetFileDate, paclet:ref/SetFileDate])["file",date,"type"] sets if possible the specified type of date for a file. Types of dates include "Access", "Creation", and "Modification". (RefLink[All, paclet:ref/All]) represents all types of dates.

(RefLink[SetFileDate, paclet:ref/SetFileDate])[(RefLink[File, paclet:ref/File])["file"]] is also supported.

OpenersPrimaryExamplesSection(Spacer1)Examples  (2)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

Copy a file:

file = FileNameJoin[{$TemporaryDirectory,"ocelot.jpg"}];

CopyFile[FileNameJoin[{$InstallationDirectory,"Documentation","English","System","ExampleData","ocelot.jpg"}], file]

The date and time at which a file was last modified:

FileDate[file]

(RefLink[SetFileDate, paclet:ref/SetFileDate]) modifies the date of the file to be the current date:

SetFileDate[file]

Check:

DateString[FileDate[file]]

Set a specific date:

SetFileDate[file,Tomorrow]

FileDate[file]

Delete the temporary file:

DeleteFile[file]

OpenersExampleSection1(Spacer1)Scope  (1)

Set the modification date of the file specified by the (RefLink[File, paclet:ref/File]) object:

file=File[CreateFile[]]

SetFileDate[file,Yesterday]

FileDate[file]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[FileDate, paclet:ref/FileDate])  ▪  (RefLink[DateObject, paclet:ref/DateObject])  ▪  (RefLink[CreateFile, paclet:ref/CreateFile])  ▪  (RefLink[FromUnixTime, paclet:ref/FromUnixTime])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Manipulating Files and Directories, paclet:tutorial/ManipulatingFilesAndDirectories])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[File Operations, paclet:guide/FileOperations])}})}})