Skip to main content

SetFileFolderInfo

SetFileFolderInfo [ /CDAT=cDate /CRE8=creatorStr /D /FTYP=typeStr /INV=inv /MDAT=mDate /P=pathName /R=r /RO=ro /STA=st /UTC[=u] /Z=z] ] [fileOrFolderNameStr]

The SetFileFolderInfo operation changes a file's or folder's properties.

Parameters

fileOrFolderNameStr specifies the file or folder to be changed.

If you use a full or partial path for fileOrFolderNameStr, see Path Separators for details on forming the path.

Folder paths should not end with single Path Separators. See MoveFolder's Details section.

If Igor cannot determine the location of the file or folder from fileOrFolderNameStr and pathName, it displays a dialog allowing you to specify the file to be deleted. Use /D to select a folder in this event, otherwise Igor prompts your for a file.

Flags

At least one of the four following flags is required, or nothing is actually accomplished:

/CDAT=cDateSpecifies the number of seconds since midnight on January 1, 1904 when the file or folder was first created. cDate is interpreted as local time or UTC depending on the /UTC flag.
/INV[=inv ]Sets the visibility of a file.
inv =0:File is visible.
inv =1:Default; file is hidden.
/MDAT=mDateSpecifies the number of seconds since midnight on January 1, 1904 when the file or folder was modified most recently. mDate is interpreted as local time or UTC depending on the /UTC flag.
/RO[=ro ]Sets the read/write state of a file or folder.
ro =0:File or folder is writable.
ro =1:File or folder is read-only (default).
This is equivalent to setting the read-only property manually using the Properties window in Windows Explorer.
See Setting Bit Parameters for details about bit settings.

Optional Flags

/DWhen pathName and fileOrFolderNameStr do not specify an existing file or folder, use the Select Folder dialog rather than Open File dialog.
/P=pathNameSpecifies the folder to look in for the file. pathName is the name of an existing symbolic path.
/R[=r ]Recursively applies change(s) to all files or folders in the folder specified by pathName or fileOrFolderNameStr, and the folder itself:
r =0:No recursion. Same as no /R.
r =1:Recursively apply changes to files.
r =2:Recursively apply changes to folders, including the folder specified by pathName or fileOrFolderNameStr.
r =3:Recursively apply changes to both files and folders (default).
/R requires /D and a folder specification.
/UTC[=u ]If you include /UTC or /UTC=1, SetFileFolderInfo interprets the creation and modification dates as UTC (coordinated universal time). If you omit /UTC or specify /UTC=0, SetFileFolderInfo interprets the creation and modification dates as local time.
The default, used if you omit /UTC, is local time.
The /UTC flag was added in Igor Pro 9.00.
/Z[=z ]Prevents procedure execution from aborting if SetFileFolderInfo tries to set information about a file or folder that does not exist. Use /Z if you want to handle this case in your procedures rather than having execution abort.
/Z=0:Same as no /Z at all.
/Z=1:Used for setting information for a file or folder only if it exists. /Z alone has the same effect as /Z=1.
/Z=2:Used for setting information for a file or folder if it exists and displaying a dialog if it does not exist.

Variables

SetFileFolderInfo returns information about the file or folder in the following variables:

V_FlagSet to zero if the file or folder was found, to -1 if the user cancelled the Open File dialog, and to some nonzero value if an error occurred, such as the specified file or folder does not exist.
S_PathSet to the file system path of the selected file or folder.

Examples

// Set a file's modification date and time
Variable hrs = 12, mins = 30, secs = 15 // 12:30:15
Variable mDate= Date2Secs(2000,12,25) + hrs*3600+mins*60+secs
SetFileFolderInfo/P=myPath/MDAT=(mDate), "afile.txt"

// Remove read-only property from a folder and everything within it:
SetFileFolderInfo/P=myPath/D/R/RO=0

See Also

GetFileFolderInfo, FStatus, IndexedFile, Date2Secs, ParseFilePath