FileTime

Version 1.6.0.0 (16.5 KB) by Jan
Get and set the times for creation, access and modification of a file or folder (Windows only)
6.2K Downloads
Updated 29 Jun 2011

View License

These MEX-functions get and set the creation, access and write times of a file under Windows.

SetFileTime(FileName, Spec, DateVector, Type)
FileName: File or folder name, absolute or relative path.
Unicode names and UNC paths are accepted.
Spec: String, 'Creation', 'Access', 'Write'.
DateVector: [1 x 6] double vector (see DATEVEC) or UINT64.
Type: Optional, conversion method from local to UTC time.

Time = GetFileTime(FileName, Type, OutType)
FileName: File or folder name, absolute or relative path.
Type: Optional, conversion method from UTC to local time.
OutType: Optional, all three times as struct or a single time.
Time: Struct with fields 'Creation', 'Access', 'Write' or
one time, [1x6] DATEVEC or UINT64 format.

The Local<->UTC conversion needs Windows XP, Windows Server 2003 or higher. The LCC 2.4 compiler shipped with Matlab does not know the "new" time function.

Precompiled mex files can be downloaded at:
http://www.n-simon.de/mex

Tested: Matlab 6.5/2009a, WinXP, 32 bit, OWC1.8, BCC5.5, LCC 3.8, MSVC 2008
Compatibility to 64 bit Windows is assumed.

Cite As

Jan (2024). FileTime (https://www.mathworks.com/matlabcentral/fileexchange/24671-filetime), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2009a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on File Operations in Help Center and MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.6.0.0

Times can have native UINT64 format. GetFileTime can reply a single time, e.g. just 'Access' time.

1.5.0.0

Consider Unicode file names.
Another fixed bug concerning local month names in the test function.

1.4.0.0

Accept unicode names.
Another fixed bug in the test function concerning local month names.

1.3.0.0

Test function failed, if DIR replies localized names for dates as e.g. the German "24-Dez-2010". No problems for English OS versions and in the actual functions.

1.2.0.0

Access folders also

1.1.0.0

UTC<->local time conversion more consistent now and flexible. Thanks Bass for pointing to this problem!

1.0.0.0