Expand/Shrink

utilities

The following simple utility routines are also provided.

Routines in the first half of this table tend to be very forgiving as regards '\\' vs '/' in the input, but any returned strings will always contain the appropriate path separators for the underlying operating system. However routines from rename_file on are usually much fussier about their input, though obviously using results from routines in the first half should be fine.

Most of these routines are not supported by pwa/p2js, except for a few that don’t do any actual file i/o, just fairly simple number or string processing, namely file_size_k, join_path, get_file_(base|extension|name[_and_path]|path[_and_name]), and to a lesser extent get_proper(dir|path).

file_exists - Check to see if a file or directory exists
get_proper_path - Return the full path and file name of the supplied file name.
get_proper_dir - Return the full directory path of the supplied file with the name removed.
get_file_name - Extract the file name portion of a filepath.
get_file_base - Extract the base portion of a file name.
get_file_extension - Extract the file extension portion of a file name.
get_file_path - Obtain the directory of a file.
get_file_type - Get the type of a file or directory.
get_file_size - Get the size of a file in bytes.
get_file_date - Get the last modification date of a file.
rename_file - Rename a file.
copy_file - Copy a file.
move_file - Move a file to another location.
temp_file - Generate a temporary filename, optionally opening it.
delete_file - Delete a file.
create_directory - Create a new directory.
clear_directory - Clears a directory of all files, but retains the directory structure.
remove_directory - Remove a directory.
join_path - Join several path segments together using the appropriate separator.