ISSourceFile.FileName

Description

The name of the source file.

Syntax

object.FileName

Part Attribute Type Description
object Required
The object always implements the ISSourceFile interface
Restriction: This property is readonly.

Return Value

string

Example

Display some information about the folder tree, including the names of the files contained.

sub main
  Dim aStore
  Dim aDialogue
  Dim aStream
  Dim aStoredFileName
  Dim aMessage
  
  set aStore = Profile.SourceStore
  EnsureFolder aStore, "Examples"
 
  set aDialogue = Profile.CreateOpenDialog
  aDialogue.Title = "Select File for adding into Source Store"
  aDialogue.Filter = "*.txt||*.rtf||*.doc||*.*||"
  aDialogue.FileName = "*.*"

  if not aDialogue.Execute then exit sub

  set aStream = Profile.MakeStream
  aStream.LoadFromFile(aDialogue.FileName)
  aStoredFileName = "Examples\" & Mid(aDialogue.FileName, InStrRev(aDialogue.FileName, "\") + 1)
 
  aStore.PutFile aStoredFileName, aStream, "The text of the example"
   
  aMessage = GetSubfoldersInfo(aStore.GetFolders(""), 0)

  Profile.MsgBox(aMessage)
end sub


function GetSubfoldersInfo(aFolders, aLevel)
  Dim i, j
  Dim aFolder, aSubFolders
  Dim aFiles, aFile
  Dim aInfo
          
  for i = 0 to aFolders.Count - 1
    set aFolder = aFolders.GetItem(i)
    set aFiles = aFolder.GetFiles(aFolder.FullPath)
    
    aInfo = aInfo & vbNewLine & Space(aLevel * 4) & aFolder.FullPath &_
      " (Files: " & aFiles.Count & ")"
    for j = 0 to aFiles.Count - 1 
      set aFile = aFiles.GetItem(j)
      aInfo = aInfo & vbNewLine & Space(aLevel * 4) & " - " & aFile.FileName      
    next 'j
      
    set aSubFolders = aFolder.GetFolders(aFolder.FullPath) 
    aInfo = aInfo & GetSubfoldersInfo(aSubFolders, aLevel + 1)
  next 'i
  
  GetSubfoldersInfo = aInfo
end function
       
    
sub EnsureFolder(aStore, aFolderName)
  Dim aFolder

  on error resume next 
  set aFolder = aStore.GetFolder(aFolderName)
  if Err.Number <> 0 Then
    Err.Clear  
    set aFolder = aStore.CreateFolder(aFolderName)
    Profile.MsgBox("The folder '" & aFolder.FullPath & "' was created")
  end if  
end sub
Note:

Version information

Added in v7.8.0