Public Function NameMaybeBackupInTemp( _
ByVal vFromPathName As Variant _
, ByVal vToPathName As Variant _
, Optional ByVal vKeepBackup As Variant _
, Optional ByVal vTempFilePrefix As Variant _
) As Boolean
Rename a file, optionally making a backup of the target file in the Windows temporary directory. Example:
StringToFile("First.", "Debug.Out") = True
' Next call backs-up Debug.1 with a name like C:\TEMP\NAM03B4.TMP
NameMaybeBackupInTemp("Debug.Out", "Debug.1", True) = True
FileToString("Debug.1") = "First."See also:
GetTempFileName FunctionvFromPathName: Current name of the file; the name that is to be changed. Function does nothing and returns False if vFromPathName is Null or cannot be fixed-up to a String.
vToPathName: New name for the file; the name that it will be changed to. Function does nothing and returns False if vToPathName is Null or cannot be fixed-up to a String.
vKeepBackup: True if the function should keep a backup of the target file vToPathName in the Windows temporary directory, or False if no backup is to be kept. vKeepBackup defaults to False (no backup will be made) if it is missing or Null or cannot be fixed-up to a number.
vTempFilePrefix: String containing the prefix for the backup file. vTempFilePrefix defaults to the name of this function ("NameMaybeBackupInTemp") if it is missing or Null or cannot be fixed-up to a String. Currently, the Windows GetTempFileName function only uses the first few characters of this String.
Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.