Difference between revisions of "FilePathPart"

(Corrections to examples EW 20133)
Line 7: Line 7:
  
 
«part» can be one of:
 
«part» can be one of:
* <code>'folder'</code>
+
* <code>'folder'</code>: FilePathPart( filepath, 'folder' ) returns the folder part of «filepath», for example:
* <code>'filename'</code>
+
** FilePathPart("C:\DataFeeds\ISO\HourlyToday.csv", 'folder') → "C:\DataFeeds\ISO"
* <code>'name'</code>
+
** FilePathPart("C:\DataFeeds\ISO\", 'folder') → "C:\DataFeeds\ISO")
* <code>'filename only'</code>
 
* <code>'extension'</code>
 
* <code>'parent'</code>
 
  
FilePathPart( filepath, 'folder' ) returns the folder part of «filepath»
+
* <code>'filename'</code>: FilePathPart( filepath, 'filename' ) returns just the filename, "" for a directory. For example:  
Examples:
+
** FilePathPart("C:\DataFeeds\ISO\HourlyToday.csv", 'filename') → "HourlyToday.csv"
• FilePathPart("C:\DataFeeds\ISO\HourlyToday.csv", 'folder') → "C:\DataFeeds\ISO"
+
** FilePathPart("C:\DataFeeds\ISO\", 'filename') → ""
• FilePathPart("C:\DataFeeds\ISO\", 'folder') → "C:\DataFeeds\ISO")
 
 
FilePathPart( filepath, 'filename' ) returns just the filename, "" for a directory.
 
Examples:  
 
FilePathPart("C:\DataFeeds\ISO\HourlyToday.csv", 'filename') → "HourlyToday.csv"
 
FilePathPart("C:\DataFeeds\ISO\", 'filename') → ""
 
  
FilePathPart( filepath, 'name' ) returns the file or folder name.
+
* <code>'name'</code>: FilePathPart( filepath, 'name' ) returns the file or folder name, for example:
FilePathPart("C:\DataFeeds\ISO\HourlyToday.csv", 'name') → "HourlyToday.csv"
+
**  FilePathPart("C:\DataFeeds\ISO\HourlyToday.csv", 'name') → "HourlyToday.csv"
FilePathPart("C:\DataFeeds\ISO\", 'name') → "ISO"
+
**  FilePathPart("C:\DataFeeds\ISO\", 'name') → "ISO"
  
FilePathPart( filepath, 'filename only' ) returns the filename without an extension
+
* <code>'filename only'</code>: FilePathPart( filepath, 'filename only' ) returns the filename without an extension
FilePathPart("C:\DataFeeds\ISO\HourlyToday.csv", 'filename only') → "HourlyToday"
+
**  FilePathPart("C:\DataFeeds\ISO\HourlyToday.csv", 'filename only') → "HourlyToday"
 
+
* <code>'extension'</code>: FilePathPart( filepath, 'extension' ) returns the lowercase file extension. Is "" for a file without  
FilePathPart( filepath, 'extension' ) returns the lowercase file extension. Is "" for a file without  
 
 
an extension, or null for a folder.
 
an extension, or null for a folder.
FilePathPart("C:\DataFeeds\ISO\HourlyToday.csv", 'extension') → "csv"
+
**  FilePathPart("C:\DataFeeds\ISO\HourlyToday.csv", 'extension') → "csv"
FilePathPart("C:\DataFeeds\ISO\", 'extension') → ""
+
**  FilePathPart("C:\DataFeeds\ISO\", 'extension') → ""
  
FilePartPart( filepath, 'parent' ) returns the parent folder which is different from 'folder, in the case of a directory.
+
* <code>'parent'</code>: FilePartPart( filepath, 'parent' ) returns the parent folder which is different from 'folder, in the case of a directory. For example:
FilePathPart("C:\DataFeeds\ISO\HourlyToday.csv", 'parent') → "C:\DataFeeds\ISO"
+
**  FilePathPart("C:\DataFeeds\ISO\HourlyToday.csv", 'parent') → "C:\DataFeeds\ISO"
FilePathPart("C:\DataFeeds\ISO\", 'parent') → "C:\DataFeeds")
+
**  FilePathPart("C:\DataFeeds\ISO\", 'parent') → "C:\DataFeeds")
  
 
== See Also ==
 
== See Also ==
 
* [[:category:File system functions|File system functions]]
 
* [[:category:File system functions|File system functions]]
 
* [[FileFullPath]]
 
* [[FileFullPath]]

Revision as of 19:51, 8 November 2021


New to Analytica 6.0

FilePathPart( filepath, part )

Returns the requested «part» of a full file path.

«part» can be one of:

  • 'folder': FilePathPart( filepath, 'folder' ) returns the folder part of «filepath», for example:
    • FilePathPart("C:\DataFeeds\ISO\HourlyToday.csv", 'folder') → "C:\DataFeeds\ISO"
    • FilePathPart("C:\DataFeeds\ISO\", 'folder') → "C:\DataFeeds\ISO")
  • 'filename': FilePathPart( filepath, 'filename' ) returns just the filename, "" for a directory. For example:
    • FilePathPart("C:\DataFeeds\ISO\HourlyToday.csv", 'filename') → "HourlyToday.csv"
    • FilePathPart("C:\DataFeeds\ISO\", 'filename') → ""
  • 'name': FilePathPart( filepath, 'name' ) returns the file or folder name, for example:
    • FilePathPart("C:\DataFeeds\ISO\HourlyToday.csv", 'name') → "HourlyToday.csv"
    • FilePathPart("C:\DataFeeds\ISO\", 'name') → "ISO"
  • 'filename only': FilePathPart( filepath, 'filename only' ) returns the filename without an extension
    • FilePathPart("C:\DataFeeds\ISO\HourlyToday.csv", 'filename only') → "HourlyToday"
  • 'extension': FilePathPart( filepath, 'extension' ) returns the lowercase file extension. Is "" for a file without

an extension, or null for a folder.

    • FilePathPart("C:\DataFeeds\ISO\HourlyToday.csv", 'extension') → "csv"
    • FilePathPart("C:\DataFeeds\ISO\", 'extension') → ""
  • 'parent': FilePartPart( filepath, 'parent' ) returns the parent folder which is different from 'folder, in the case of a directory. For example:
    • FilePathPart("C:\DataFeeds\ISO\HourlyToday.csv", 'parent') → "C:\DataFeeds\ISO"
    • FilePathPart("C:\DataFeeds\ISO\", 'parent') → "C:\DataFeeds")

See Also

Comments


You are not allowed to post comments.