Namespace: Consultingwerk.Util
Class 
FileHelper Copy to Clipboard
Parent classes:
Inherits: Progress.Lang.Object

File:FileHelper
Purpose:File System Helper methods
Syntax:Static methods only, Protected constructor to disallow
instance creation
Author(s):Mike Fechner / Consultingwerk Ltd.
Created:Sun Jun 26 11:07:56 CEST 2011



Top Method Summary
Options Name Purpose
+ LOGICAL CanFindTextInBinaryFile (character, character) Returns if the given string value can be found in the provided file name
+ CHARACTER CombinePath (character, character) Combines the provided path into a single path
+ CHARACTER CombinePath (character, character, character) Combines the provided path into a single path
+ CHARACTER CombinePath (character, character, character, character) Combines the provided path into a single path
+ CHARACTER CombinePath (character, character, character, character, character) Combines the provided path into a single path
+ CHARACTER CombinePath (character, character, character, character, character, character) Combines the provided path into a single path
+ CHARACTER CombinePath (character, character, character, character, character, character, character) Combines the provided path into a single path
+ CHARACTER CombinePath (character, character, character, character, character, character, character, character) Combines the provided path into a single path
+ CHARACTER CombinePath (character, character, character, character, character, character, character, character, character) Combines the provided path into a single path
+ CHARACTER CombinePath (character, character, character, character, character, character, character, character, character, character) Combines the provided path into a single path
+ CopyFiles (character, character, character) Copies files from one path to a target directory
+ INTEGER CreateDirectory (character) Creates all directories and subdirectories in the specified path.
+ CHARACTER DirectoryName (character) Returns the directory portion of a file name, absolutely or relatively
+ EnsureFileNameCase (character) Ensures that the given OS file is cased in exactly the same way as passed in
+ LOGICAL Exists (character) Returns True when the file can be found in the PROPATH
+ CHARACTER FileExtension (character) Returns the file name extension of an operating system file excluding the dot (.). If the file does not have an extension, returns Null ("")
+ CHARACTER FindFile (character) Returns the absolute file name for the given file
+ GetFileList (character, character, table) Returns the List of files on disk for the specified criteria
+ GetFileListNoDotNet (character, character, table) Returns the List of files on disk for the specified criteria
+ CHARACTER GetTempFileName () Returns a temporary filename either using a .NET API or based on a GUID and the AVM SESSION:TEMP-DIRECTORY
+ CHARACTER HumanReadableFileSize (int64) Returns a human readable file size including the Unit
+ CHARACTER NormalizePathname (character) Returns a normalized path name
+ CHARACTER OS-ERROR-TEXT (integer) Returns the error message of an OS-ERROR value
+ CHARACTER RelativeFileName (character) Return relative path if file is in propath
+ CHARACTER ReplaceFileExtension (character, character) Replaces the extension of a file
+ CHARACTER ShortFileName (character) Returns just the file name portion of a relative or absolute file name
+ CHARACTER ShortFileNameWithoutExtension (character) Returns just the file name portion of a relative or absolute file name without the file extension

Top Constructor Summary
Options Name Purpose
# FileHelper () Disallow instance creation


Method Detail
Top

PUBLIC LOGICAL CanFindTextInBinaryFile (character, character)

Purpose: Returns if the given string value can be found in the provided file
name
Notes:

Parameters:
pcSearchString CHARACTER
The string value to search
pcFileName CHARACTER
The file name
Returns LOGICAL
Logical value indicating if the file can be found
Top

PUBLIC CHARACTER CombinePath (character, character)

Purpose: Combines the provided path into a single path
Notes: Does not validate the resulting path entry

Parameters:
pcPath1 CHARACTER
The first path entry to combine
pcPath2 CHARACTER
The second path entry to combine
Returns CHARACTER
The combined path
Top

PUBLIC CHARACTER CombinePath (character, character, character)

Purpose: Combines the provided path into a single path
Notes: Does not validate the resulting path entry

Parameters:
pcPath1 CHARACTER
The first path entry to combine
pcPath2 CHARACTER
The second path entry to combine
pcPath3 CHARACTER
The thrid path entry to combine
Returns CHARACTER
The combined path
Top

PUBLIC CHARACTER CombinePath (character, character, character, character)

Purpose: Combines the provided path into a single path
Notes: Does not validate the resulting path entry

Parameters:
pcPath1 CHARACTER
The first path entry to combine
pcPath2 CHARACTER
The second path entry to combine
pcPath3 CHARACTER
The thrid path entry to combine
pcPath4 CHARACTER
The fourth path entry to combine
Returns CHARACTER
The combined path
Top

PUBLIC CHARACTER CombinePath (character, character, character, character, character)

Purpose: Combines the provided path into a single path
Notes: Does not validate the resulting path entry

Parameters:
pcPath1 CHARACTER
The first path entry to combine
pcPath2 CHARACTER
The second path entry to combine
pcPath3 CHARACTER
The thrid path entry to combine
pcPath4 CHARACTER
The fourth path entry to combine
pcPath5 CHARACTER
The fifth path entry to combine
Returns CHARACTER
The combined path
Top

PUBLIC CHARACTER CombinePath (character, character, character, character, character, character)

Purpose: Combines the provided path into a single path
Notes: Does not validate the resulting path entry

Parameters:
pcPath1 CHARACTER
The first path entry to combine
pcPath2 CHARACTER
The second path entry to combine
pcPath3 CHARACTER
The thrid path entry to combine
pcPath4 CHARACTER
The fourth path entry to combine
pcPath5 CHARACTER
The fifth path entry to combine
pcPath6 CHARACTER
The sixth path entry to combine
Returns CHARACTER
The combined path
Top

PUBLIC CHARACTER CombinePath (character, character, character, character, character, character, character)

Purpose: Combines the provided path into a single path
Notes: Does not validate the resulting path entry

Parameters:
pcPath1 CHARACTER
The first path entry to combine
pcPath2 CHARACTER
The second path entry to combine
pcPath3 CHARACTER
The thrid path entry to combine
pcPath4 CHARACTER
The fourth path entry to combine
pcPath5 CHARACTER
The fifth path entry to combine
pcPath6 CHARACTER
The sixth path entry to combine
pcPath7 CHARACTER
The seventh path entry to combine
Returns CHARACTER
The combined path
Top

PUBLIC CHARACTER CombinePath (character, character, character, character, character, character, character, character)

Purpose: Combines the provided path into a single path
Notes: Does not validate the resulting path entry

Parameters:
pcPath1 CHARACTER
The first path entry to combine
pcPath2 CHARACTER
The second path entry to combine
pcPath3 CHARACTER
The thrid path entry to combine
pcPath4 CHARACTER
The fourth path entry to combine
pcPath5 CHARACTER
The fifth path entry to combine
pcPath6 CHARACTER
The sixth path entry to combine
pcPath7 CHARACTER
The seventh path entry to combine
pcPath8 CHARACTER
The eight path entry to combine
Returns CHARACTER
The combined path
Top

PUBLIC CHARACTER CombinePath (character, character, character, character, character, character, character, character, character)

Purpose: Combines the provided path into a single path
Notes: Does not validate the resulting path entry

Parameters:
pcPath1 CHARACTER
The first path entry to combine
pcPath2 CHARACTER
The second path entry to combine
pcPath3 CHARACTER
The thrid path entry to combine
pcPath4 CHARACTER
The fourth path entry to combine
pcPath5 CHARACTER
The fifth path entry to combine
pcPath6 CHARACTER
The sixth path entry to combine
pcPath7 CHARACTER
The seventh path entry to combine
pcPath8 CHARACTER
The eight path entry to combine
pcPath9 CHARACTER
The ninth path entry to combine
Returns CHARACTER
The combined path
Top

PUBLIC CHARACTER CombinePath (character, character, character, character, character, character, character, character, character, character)

Purpose: Combines the provided path into a single path
Notes: Does not validate the resulting path entry

Parameters:
pcPath1 CHARACTER
The first path entry to combine
pcPath2 CHARACTER
The second path entry to combine
pcPath3 CHARACTER
The thrid path entry to combine
pcPath4 CHARACTER
The fourth path entry to combine
pcPath5 CHARACTER
The fifth path entry to combine
pcPath6 CHARACTER
The sixth path entry to combine
pcPath7 CHARACTER
The seventh path entry to combine
pcPath8 CHARACTER
The eight path entry to combine
pcPath9 CHARACTER
The ninth path entry to combine
pcPath10 CHARACTER
The tenth path entry to combine
Returns CHARACTER
The combined path
Top

PUBLIC CopyFiles (character, character, character)

Purpose: Copies files from one path to a target directory
Notes:

Parameters:
pcSourcePath CHARACTER
The source file path
pcFileMask CHARACTER
A comma-delimited list of file patterns to copy (e.g. *.xml,*.resx)
pcTargetPath CHARACTER
The directory to copy into
Top

PUBLIC INTEGER CreateDirectory (character)

Purpose: Creates all directories and subdirectories in the specified path.
Notes:

Parameters:
pcPath CHARACTER
The path to create
Returns INTEGER
0 when success otherwise 999 on windows (Exception) or the OS-ERROR on UNIX
Top

PUBLIC CHARACTER DirectoryName (character)

Purpose: Returns the directory portion of a file name, absolutely or relatively
Notes:

Parameters:
pcFileName CHARACTER
The base file name
Returns CHARACTER
The directory portion of the file name
Top

PUBLIC EnsureFileNameCase (character)

Purpose: Ensures that the given OS file is cased in exactly the same way as
passed in
Notes:

Parameters:
pcFileName CHARACTER
The file name to verify
Top

PUBLIC LOGICAL Exists (character)

Purpose: Returns True when the file can be found in the PROPATH
Notes:

Parameters:
pcFileName CHARACTER
The file name to search
Returns LOGICAL
Logical value indicating if the file can be found
Top

PUBLIC CHARACTER FileExtension (character)

Purpose: Returns the file name extension of an operating system file excluding
the dot (.). If the file does not have an extension, returns Null ("")
Notes: Wrapper/facade to adecomm/_osfext.p, but excludes the leading dot

Parameters:
pcFileName CHARACTER
The name of the file to return the extension for
Returns CHARACTER
The file extension
Top

PUBLIC CHARACTER FindFile (character)

Purpose: Returns the absolute file name for the given file
Notes:

Parameters:
pcFileName CHARACTER
The file name to search
Returns CHARACTER
The absolute path to the file or ? when the file is not found
Top

PUBLIC GetFileList (character, character, table)

Purpose: Returns the List of files on disk for the specified criteria
Notes:

Parameters:
pcDirectory CHARACTER
The directory to search files in (including subdirectories)
pcFileMask CHARACTER
A comma-delimited list of file name patterns to return (e.g. *.cls,*.w,*.p)
ttFileNames TABLE
OUTPUT TABLE containing the matching file names (Consultingwerk/Util/TempTables/ttFileNames.i)
Top

PUBLIC GetFileListNoDotNet (character, character, table)

Purpose: Returns the List of files on disk for the specified criteria
Notes: The routine is an alternative to GetFileList and does not require
access to the .NET Framework (suitable for 10.2B AppServer and
UNIX)

Parameters:
pcDirectory CHARACTER
The directory to search files in (including subdirectories)
pcFileMask CHARACTER
A comma-delimited list of file name patterns to return (e.g. *.cls,*.w,*.p)
ttFileNames TABLE
OUTPUT TABLE containing the matching file names (Consultingwerk/Util/TempTables/ttFileNames.i)
Top

PUBLIC CHARACTER GetTempFileName ()

Purpose: Returns a temporary filename either using a .NET API or based on
a GUID and the AVM SESSION:TEMP-DIRECTORY
Notes: The .NET GUI will create an empty temp-file to "block" the file

Returns CHARACTER
The name for a temporary file
Top

PUBLIC CHARACTER HumanReadableFileSize (int64)

Purpose: Returns a human readable file size including the Unit
Notes: E.g 10 Bytes, 20 kB, 1.2 MB, ...

Parameters:
piFileSize INT64
The file size to convert into a human readable file size
Returns CHARACTER
The string with the file size including the unit
Top

PUBLIC CHARACTER NormalizePathname (character)

Purpose: Returns a normalized path name
Notes: Replaces back slash with forward slash

Parameters:
pcSourcePathname CHARACTER
The source path name
Returns CHARACTER
The path name with forward slahes only
Top

PUBLIC CHARACTER OS-ERROR-TEXT (integer)

Purpose: Returns the error message of an OS-ERROR value
Notes:

Parameters:
piOSError INTEGER
The OS-ERROR Error code
Returns CHARACTER
The OS-ERROR Text
Top

PUBLIC CHARACTER RelativeFileName (character)

Purpose: Return relative path if file is in propath
Notes: Based on adecomm/_relfile.p

Parameters:
pcFileName CHARACTER
The (absolute) name of a file
Returns CHARACTER
The relative file name based on the current propath
Top

PUBLIC CHARACTER ReplaceFileExtension (character, character)

Purpose: Replaces the extension of a file
Notes: When the source file name does not have an extension, the extension
will be added

Parameters:
pcSourceFileName CHARACTER
The original file name optionally including a path
pcExtension CHARACTER
The extension to use in the returned file name
Returns CHARACTER
The target file name with the replaces extension
Top

PUBLIC CHARACTER ShortFileName (character)

Purpose: Returns just the file name portion of a relative or absolute file
name
Notes:

Parameters:
pcPath CHARACTER
The base path
Returns CHARACTER
The file name portion of the path
Top

PUBLIC CHARACTER ShortFileNameWithoutExtension (character)

Purpose: Returns just the file name portion of a relative or absolute file
name without the file extension
Notes:

Parameters:
pcPath CHARACTER
The base path
Returns CHARACTER
The file name portion of the path without the file extension


Constructor Detail
Top

PROTECTED FileHelper ()

Purpose: Disallow instance creation
Notes:



©2006-2016 Consultingwerk Ltd.         info@consultingwerk.de         http://www.consultingwerk.de       26.08.2016 08:46:28