SetFileDate

SetFileDate["file"]
sets the modification and access dates for a file to be the current date.

DetailsDetails

  • 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 DateList.
  • SetFileDate["file",date,"type"] sets if possible the specified type of date for a file. Types of dates include "Access", "Creation", and "Modification". All represents all types of dates.
  • SetFileDate[File["file"]] is also supported.

ExamplesExamplesopen allclose all

Basic Examples  (1)Basic Examples  (1)

Copy a file:

In[1]:=
Click for copyable input
In[2]:=
Click for copyable input
Out[2]=

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

In[3]:=
Click for copyable input
Out[3]=

SetFileDate modifies the date of the file to be the current date:

In[4]:=
Click for copyable input

Check:

In[5]:=
Click for copyable input
Out[5]=

Set a specific date:

In[6]:=
Click for copyable input
In[7]:=
Click for copyable input
Out[7]=

Delete the temporary file:

In[8]:=
Click for copyable input
Introduced in 1991
(2.0)
| Updated in 2016
(11.0)