setTimes

Set access/modified times of file or folder name.

  1. void setTimes(R name, SysTime accessTime, SysTime modificationTime)
  2. void setTimes(R name, SysTime accessTime, SysTime modificationTime)

Parameters

name R

File/Folder name to get times for.

accessTime SysTime

Time the file/folder was last accessed.

modificationTime SysTime

Time the file/folder was last modified.

Throws

FileException on error.

Examples

import std.datetime : DateTime, hnsecs, SysTime;

scope(exit) deleteme.remove;
write(deleteme, "a");

SysTime accessTime = SysTime(DateTime(2010, 10, 4, 0, 0, 30));
SysTime modificationTime = SysTime(DateTime(2018, 10, 4, 0, 0, 30));
setTimes(deleteme, accessTime, modificationTime);

SysTime accessTimeResolved, modificationTimeResolved;
getTimes(deleteme, accessTimeResolved, modificationTimeResolved);

assert(accessTime == accessTimeResolved);
assert(modificationTime == modificationTimeResolved);

Meta