FILE.MODIFIED (U-SQL)

Summary

Returns the last modified timestamp of the file at the specified location at compile time as a DateTime value (Kind is Unspecified).

Syntax

DateTime? MODIFIED(
    string path
).                                                                                                       

Parameters

  • path
    A constant-foldable string expression. path can be any supported file path Universal Resource Identifier (URI). If path is not constant-foldable, the error E_CSC_USER_EXPRESSIONNOTCONSTANTFOLDABLE is raised. If path is empty (null or the zero-length string), the error E_CSC_USER_EMPTYFILEPATH is raised. If path contains invalid characters, the error E_CSC_USER_INVALIDFILENAME is raised.

Return Value

DateTime?
The last modified timestamp of path at compile time as a DateTime value (Kind is Unspecified). Null if path does not exists, refers to a folder or the user has no access to it.

Examples

DECLARE @filepath_good = "/Samples/Data/SearchLog.tsv";
DECLARE @filepath_bad = "/Samples/Data/zzz.tsv";
 
@result =
    SELECT  FILE.MODIFIED(@filepath_good) AS modified_datetime_good,
            FILE.MODIFIED(@filepath_bad) AS modified_datetime_bad
    FROM (VALUES (1)) AS T(dummy);
 
OUTPUT @result
TO "/Output/ReferenceGuide/BuiltInFunctions/SystemFunctions/FileModified.txt"
USING Outputters.Csv();

See Also