Sitecore 5.0 API

MainUtil.MakeFilePath Method (String, String, Boolean)

Builds a file path from a folder and a file.

[Visual Basic]
Overloads Public Shared Function MakeFilePath( _
   ByVal folder As String, _
   ByVal file As String, _
   ByVal unique As Boolean _
) As String
[C#]
public static string MakeFilePath(
   string folder,
   string file,
   bool unique
);

Parameters

folder
A folder path.
file
A file name.
unique
A flag indicating that the file should be unique in the folder.

Return Value

A file path.

Remarks

If the folder path does not end with a backslash (\), it is appended.

If unique is true, a serial number is appended to the filename. This serial number is incremented until a file with that name does not exist in the folder.

Example

  string filename = FileUtil.MakePath("c:\sitecore\client\images", "images.gif");
  // c:\sitecore\client\images\images_001.gif

See Also

MainUtil Class | Sitecore Namespace | MainUtil.MakeFilePath Overload List