{"id":1430,"date":"2019-06-28T08:24:06","date_gmt":"2019-06-28T00:24:06","guid":{"rendered":"http:\/\/www.hefeiyu.com\/?p=1430"},"modified":"2019-06-28T08:26:20","modified_gmt":"2019-06-28T00:26:20","slug":"tiptop-genero-%e6%8a%80%e4%b8%93%e6%b2%a1%e6%95%99%e7%9a%84%e4%ba%8b","status":"publish","type":"post","link":"https:\/\/www.hefeiyu.com\/?p=1430","title":{"rendered":"Tiptop -Genero \u6280\u4e13\u6ca1\u6559\u7684\u4e8b"},"content":{"rendered":"<h3>Genero \u6280\u8f6c\u6ca1\u6559\u7684\u4e8b (01) \u2013 \u6587\u4ef6\u7cfb\u7edf\u5904\u7406<\/h3>\n<h1>File Management Class<\/h1>\n<p>link to 4js.com:<\/p>\n<ul>\n<li><a href=\"http:\/\/www.4js.com\/online_documentation\/fjs-fgl-2.11.01-manual-html\/User\/Ext_os_Path.html#BASICS#BASICS\">Basics<\/a><\/li>\n<li><a href=\"http:\/\/www.4js.com\/online_documentation\/fjs-fgl-2.11.01-manual-html\/User\/Ext_os_Path.html#SYNTAX#SYNTAX\">Syntax<\/a><\/li>\n<li><a href=\"http:\/\/www.4js.com\/online_documentation\/fjs-fgl-2.11.01-manual-html\/User\/Ext_os_Path.html#METHODS#METHODS\">Methods<\/a><\/li>\n<li><a href=\"http:\/\/www.4js.com\/online_documentation\/fjs-fgl-2.11.01-manual-html\/User\/Ext_os_Path.html#EXAMPLES#EXAMPLES\">Examples<\/a>\n<ul>\n<li><a href=\"http:\/\/www.4js.com\/online_documentation\/fjs-fgl-2.11.01-manual-html\/User\/Ext_os_Path.html#EXAMPLE_1#EXAMPLE_1\">Example 1: Extracting the parts of a file name<\/a><\/li>\n<li><a href=\"http:\/\/www.4js.com\/online_documentation\/fjs-fgl-2.11.01-manual-html\/User\/Ext_os_Path.html#EXAMPLE_2#EXAMPLE_2\">Example 2: Browsing directories<\/a><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><em>See also:<\/em> <a href=\"http:\/\/www.4js.com\/online_documentation\/fjs-fgl-2.11.01-manual-html\/User\/BuiltInFunctions.html\">Built-in Functions<\/a><\/p>\n<h2>Basics<\/h2>\n<p>The Path class provides functions to manipulate files and directories on the machine where the BDL program executes.<\/p>\n<p>This API is provided as a <a href=\"http:\/\/www.4js.com\/online_documentation\/fjs-fgl-2.11.01-manual-html\/User\/CExtensions.html\">Dynamic C Extension<\/a> library; it is part of the standard package.<\/p>\n<p>To use this extension, you must import the <strong>os<\/strong> package in your program:<\/p>\n<p>IMPORT os<\/p>\n<p><strong>Warning: In order to manipulate files, this API give you access to low-level system functions. Pay attention to operating system specific conventions like path separators. Some functions are OS specific, like <\/strong><a href=\"http:\/\/www.4js.com\/online_documentation\/fjs-fgl-2.11.01-manual-html\/User\/Ext_os_Path.html#FILE_RWX#FILE_RWX\"><strong>rwx()<\/strong><\/a><strong> which works only on UNIX systems. <\/strong><\/p>\n<h2>Syntax<\/h2>\n<p>The <strong>Path<\/strong> class provides an interface to manipulate files and directories.<\/p>\n<h4>Syntax:<\/h4>\n<p>os.Path<\/p>\n<h4>Notes:<\/h4>\n<ol>\n<li>This class does not have to be instantiated; it provides class methods for the current program.<\/li>\n<\/ol>\n<h2>Methods:<\/h2>\n<table>\n<tbody>\n<tr>\n<td colspan=\"2\"><strong>Class Methods<\/strong><\/td>\n<\/tr>\n<tr>\n<td><strong>Name<\/strong><\/td>\n<td><strong>Description<\/strong><\/td>\n<\/tr>\n<tr>\n<td><a href=\"http:\/\/www.4js.com\/online_documentation\/fjs-fgl-2.11.01-manual-html\/User\/Ext_os_Path.html#FILE_SEPARATOR#FILE_SEPARATOR\">separator<\/a><\/td>\n<td>Returns the character used to separate path segments.<\/td>\n<\/tr>\n<tr>\n<td><a href=\"http:\/\/www.4js.com\/online_documentation\/fjs-fgl-2.11.01-manual-html\/User\/Ext_os_Path.html#FILE_PATHSEPARATOR#FILE_PATHSEPARATOR\">pathseparator<\/a><\/td>\n<td>Returns the character used in environment variables to separate path elements.<\/td>\n<\/tr>\n<tr>\n<td><a href=\"http:\/\/www.4js.com\/online_documentation\/fjs-fgl-2.11.01-manual-html\/User\/Ext_os_Path.html#FILE_BASENAME#FILE_BASENAME\">basename<\/a><\/td>\n<td>Returns the last element of a path.<\/td>\n<\/tr>\n<tr>\n<td><a href=\"http:\/\/www.4js.com\/online_documentation\/fjs-fgl-2.11.01-manual-html\/User\/Ext_os_Path.html#FILE_DIRNAME#FILE_DIRNAME\">dirname<\/a><\/td>\n<td>Returns all components of a path excluding the last one.<\/td>\n<\/tr>\n<tr>\n<td><a href=\"http:\/\/www.4js.com\/online_documentation\/fjs-fgl-2.11.01-manual-html\/User\/Ext_os_Path.html#FILE_ROOTNAME#FILE_ROOTNAME\">rootname<\/a><\/td>\n<td>Returns the file path without the file extension of the last element of the file path.<\/td>\n<\/tr>\n<tr>\n<td><a href=\"http:\/\/www.4js.com\/online_documentation\/fjs-fgl-2.11.01-manual-html\/User\/Ext_os_Path.html#FILE_JOIN#FILE_JOIN\">join<\/a><\/td>\n<td>Joins two path segments adding the platform-dependent separator.<\/td>\n<\/tr>\n<tr>\n<td><a href=\"http:\/\/www.4js.com\/online_documentation\/fjs-fgl-2.11.01-manual-html\/User\/Ext_os_Path.html#FILE_PATHTYPE#FILE_PATHTYPE\">pathtype<\/a><\/td>\n<td>Checks whether a path is a relative path or an absolute path.<\/td>\n<\/tr>\n<tr>\n<td><a href=\"http:\/\/www.4js.com\/online_documentation\/fjs-fgl-2.11.01-manual-html\/User\/Ext_os_Path.html#FILE_EXISTS#FILE_EXISTS\">exists<\/a><\/td>\n<td>Checks if a file exists.<\/td>\n<\/tr>\n<tr>\n<td><a href=\"http:\/\/www.4js.com\/online_documentation\/fjs-fgl-2.11.01-manual-html\/User\/Ext_os_Path.html#FILE_EXTENSION#FILE_EXTENSION\">extension<\/a><\/td>\n<td>Returns the file extension.<\/td>\n<\/tr>\n<tr>\n<td><a href=\"http:\/\/www.4js.com\/online_documentation\/fjs-fgl-2.11.01-manual-html\/User\/Ext_os_Path.html#FILE_READABLE#FILE_READABLE\">readable<\/a><\/td>\n<td>Checks if a file is readable.<\/td>\n<\/tr>\n<tr>\n<td><a href=\"http:\/\/www.4js.com\/online_documentation\/fjs-fgl-2.11.01-manual-html\/User\/Ext_os_Path.html#FILE_WRITABLE#FILE_WRITABLE\">writable<\/a><\/td>\n<td>Checks if a file is writable.<\/td>\n<\/tr>\n<tr>\n<td><a href=\"http:\/\/www.4js.com\/online_documentation\/fjs-fgl-2.11.01-manual-html\/User\/Ext_os_Path.html#FILE_EXECUTABLE#FILE_EXECUTABLE\">executable<\/a><\/td>\n<td>Checks if a file is executable.<\/td>\n<\/tr>\n<tr>\n<td><a href=\"http:\/\/www.4js.com\/online_documentation\/fjs-fgl-2.11.01-manual-html\/User\/Ext_os_Path.html#FILE_ISFILE#FILE_ISFILE\">isfile<\/a><\/td>\n<td>Checks if a file is a regular file.<\/td>\n<\/tr>\n<tr>\n<td><a href=\"http:\/\/www.4js.com\/online_documentation\/fjs-fgl-2.11.01-manual-html\/User\/Ext_os_Path.html#FILE_ISDIRECTORY#FILE_ISDIRECTORY\">isdirectory<\/a><\/td>\n<td>Checks if a file is a directory.<\/td>\n<\/tr>\n<tr>\n<td><a href=\"http:\/\/www.4js.com\/online_documentation\/fjs-fgl-2.11.01-manual-html\/User\/Ext_os_Path.html#FILE_ISHIDDEN#FILE_ISHIDDEN\">ishidden<\/a><\/td>\n<td>Checks if a file is hidden.<\/td>\n<\/tr>\n<tr>\n<td><a href=\"http:\/\/www.4js.com\/online_documentation\/fjs-fgl-2.11.01-manual-html\/User\/Ext_os_Path.html#FILE_ISLINK#FILE_ISLINK\">islink<\/a><\/td>\n<td>Checks if a file is a UNIX symbolic link.<\/td>\n<\/tr>\n<tr>\n<td><a href=\"http:\/\/www.4js.com\/online_documentation\/fjs-fgl-2.11.01-manual-html\/User\/Ext_os_Path.html#FILE_ISROOT#FILE_ISROOT\">isroot<\/a><\/td>\n<td>Checks if a file is a root path.<\/td>\n<\/tr>\n<tr>\n<td><a href=\"http:\/\/www.4js.com\/online_documentation\/fjs-fgl-2.11.01-manual-html\/User\/Ext_os_Path.html#FILE_TYPE#FILE_TYPE\">type<\/a><\/td>\n<td>Returns the file type as a string.<\/td>\n<\/tr>\n<tr>\n<td><a href=\"http:\/\/www.4js.com\/online_documentation\/fjs-fgl-2.11.01-manual-html\/User\/Ext_os_Path.html#FILE_SIZE#FILE_SIZE\">size<\/a><\/td>\n<td>Returns the file size.<\/td>\n<\/tr>\n<tr>\n<td><a href=\"http:\/\/www.4js.com\/online_documentation\/fjs-fgl-2.11.01-manual-html\/User\/Ext_os_Path.html#FILE_ATIME#FILE_ATIME\">atime<\/a><\/td>\n<td>Returns the time of the last file access.<\/td>\n<\/tr>\n<tr>\n<td><a href=\"http:\/\/www.4js.com\/online_documentation\/fjs-fgl-2.11.01-manual-html\/User\/Ext_os_Path.html#FILE_CHOWN#FILE_CHOWN\">chown<\/a><\/td>\n<td>Changes the UNIX owner and group of a file.<\/td>\n<\/tr>\n<tr>\n<td><a href=\"http:\/\/www.4js.com\/online_documentation\/fjs-fgl-2.11.01-manual-html\/User\/Ext_os_Path.html#FILE_UID#FILE_UID\">uid<\/a><\/td>\n<td>Returns the UNIX user id of the file.<\/td>\n<\/tr>\n<tr>\n<td><a href=\"http:\/\/www.4js.com\/online_documentation\/fjs-fgl-2.11.01-manual-html\/User\/Ext_os_Path.html#FILE_GID#FILE_GID\">gid<\/a><\/td>\n<td>Returns the UNIX group id of the file.<\/td>\n<\/tr>\n<tr>\n<td><a href=\"http:\/\/www.4js.com\/online_documentation\/fjs-fgl-2.11.01-manual-html\/User\/Ext_os_Path.html#FILE_RWX#FILE_RWX\">rwx<\/a><\/td>\n<td>Returns the UNIX permissions on the file.<\/td>\n<\/tr>\n<tr>\n<td><a href=\"http:\/\/www.4js.com\/online_documentation\/fjs-fgl-2.11.01-manual-html\/User\/Ext_os_Path.html#FILE_CHRWX#FILE_CHRWX\">chrwx<\/a><\/td>\n<td>Changes the UNIX permissions of a file.<\/td>\n<\/tr>\n<tr>\n<td><a href=\"http:\/\/www.4js.com\/online_documentation\/fjs-fgl-2.11.01-manual-html\/User\/Ext_os_Path.html#FILE_MTIME#FILE_MTIME\">mtime<\/a><\/td>\n<td>Returns the time of the last file modification.<\/td>\n<\/tr>\n<tr>\n<td><a href=\"http:\/\/www.4js.com\/online_documentation\/fjs-fgl-2.11.01-manual-html\/User\/Ext_os_Path.html#FILE_HOMEDIR#FILE_HOMEDIR\">homedir<\/a><\/td>\n<td>Returns the path to the HOME directory of the current user.<\/td>\n<\/tr>\n<tr>\n<td><a href=\"http:\/\/www.4js.com\/online_documentation\/fjs-fgl-2.11.01-manual-html\/User\/Ext_os_Path.html#FILE_ROOTDIR#FILE_ROOTDIR\">rootdir<\/a><\/td>\n<td>Returns the root directory of the current path.<\/td>\n<\/tr>\n<tr>\n<td><a href=\"http:\/\/www.4js.com\/online_documentation\/fjs-fgl-2.11.01-manual-html\/User\/Ext_os_Path.html#FILE_DIRFMASK#FILE_DIRFMASK\">dirfmask<\/a><\/td>\n<td>Defines the filter mask for a <a href=\"http:\/\/www.4js.com\/online_documentation\/fjs-fgl-2.11.01-manual-html\/User\/Ext_os_Path.html#FILE_DIROPEN#FILE_DIROPEN\">diropen<\/a> call<\/td>\n<\/tr>\n<tr>\n<td><a href=\"http:\/\/www.4js.com\/online_documentation\/fjs-fgl-2.11.01-manual-html\/User\/Ext_os_Path.html#FILE_DIRSORT#FILE_DIRSORT\">dirsort<\/a><\/td>\n<td>Defines the sort criteria and sort order for a <a href=\"http:\/\/www.4js.com\/online_documentation\/fjs-fgl-2.11.01-manual-html\/User\/Ext_os_Path.html#FILE_DIROPEN#FILE_DIROPEN\">diropen<\/a> call<\/td>\n<\/tr>\n<tr>\n<td><a href=\"http:\/\/www.4js.com\/online_documentation\/fjs-fgl-2.11.01-manual-html\/User\/Ext_os_Path.html#FILE_DIROPEN#FILE_DIROPEN\">diropen<\/a><\/td>\n<td>Opens a directory and returns an integer handle to this directory.<\/td>\n<\/tr>\n<tr>\n<td><a href=\"http:\/\/www.4js.com\/online_documentation\/fjs-fgl-2.11.01-manual-html\/User\/Ext_os_Path.html#FILE_DIRCLOSE#FILE_DIRCLOSE\">dirclose<\/a><\/td>\n<td>Closes the directory referenced by the directory handle.<\/td>\n<\/tr>\n<tr>\n<td><a href=\"http:\/\/www.4js.com\/online_documentation\/fjs-fgl-2.11.01-manual-html\/User\/Ext_os_Path.html#FILE_DIRNEXT#FILE_DIRNEXT\">dirnext<\/a><\/td>\n<td>Reads the next entry of the directory referenced by the directory handle.<\/td>\n<\/tr>\n<tr>\n<td><a href=\"http:\/\/www.4js.com\/online_documentation\/fjs-fgl-2.11.01-manual-html\/User\/Ext_os_Path.html#FILE_PWD#FILE_PWD\">pwd<\/a><\/td>\n<td>Returns the current working directory.<\/td>\n<\/tr>\n<tr>\n<td><a href=\"http:\/\/www.4js.com\/online_documentation\/fjs-fgl-2.11.01-manual-html\/User\/Ext_os_Path.html#FILE_CHDIR#FILE_CHDIR\">chdir<\/a><\/td>\n<td>Changes the current working directory<\/td>\n<\/tr>\n<tr>\n<td><a href=\"http:\/\/www.4js.com\/online_documentation\/fjs-fgl-2.11.01-manual-html\/User\/Ext_os_Path.html#FILE_VOLUMES#FILE_VOLUMES\">volumes<\/a><\/td>\n<td>Returns the list of available volumes.<\/td>\n<\/tr>\n<tr>\n<td><a href=\"http:\/\/www.4js.com\/online_documentation\/fjs-fgl-2.11.01-manual-html\/User\/Ext_os_Path.html#FILE_CHVOLUME#FILE_CHVOLUME\">chvolume<\/a><\/td>\n<td>Changes the current working volume.<\/td>\n<\/tr>\n<tr>\n<td><a href=\"http:\/\/www.4js.com\/online_documentation\/fjs-fgl-2.11.01-manual-html\/User\/Ext_os_Path.html#FILE_MKDIR#FILE_MKDIR\">mkdir<\/a><\/td>\n<td>Creates a new directory.<\/td>\n<\/tr>\n<tr>\n<td><a href=\"http:\/\/www.4js.com\/online_documentation\/fjs-fgl-2.11.01-manual-html\/User\/Ext_os_Path.html#FILE_DELETE#FILE_DELETE\">delete<\/a><\/td>\n<td>Deletes a file or a directory.<\/td>\n<\/tr>\n<tr>\n<td><a href=\"http:\/\/www.4js.com\/online_documentation\/fjs-fgl-2.11.01-manual-html\/User\/Ext_os_Path.html#FILE_RENAME#FILE_RENAME\">rename<\/a><\/td>\n<td>Renames a file or a directory.<\/td>\n<\/tr>\n<tr>\n<td><a href=\"http:\/\/www.4js.com\/online_documentation\/fjs-fgl-2.11.01-manual-html\/User\/Ext_os_Path.html#FILE_COPY#FILE_COPY\">copy<\/a><\/td>\n<td>Copies a regular file.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3><a id=\"post-1430-FILE_SEPARATOR\"><\/a>os.Path.separator<\/h3>\n<h4>Purpose:<\/h4>\n<p>Returns the character used to separate path segments.<\/p>\n<h4>Syntax:<\/h4>\n<p>CALL os.Path.separator() RETURNING <em>separator<\/em> STRING<\/p>\n<h4>Notes:<\/h4>\n<ol>\n<li><em>separator<\/em> contains the separator.<\/li>\n<li>On Unix, the separator is &#8216;\/&#8217;<\/li>\n<li>On Windows, the separator is &#8216;\\&#8217;<\/li>\n<\/ol>\n<h3><a id=\"post-1430-FILE_PATHSEPARATOR\"><\/a>os.Path.pathseparator<\/h3>\n<h4>Purpose:<\/h4>\n<p>Returns the character used in environment variables to separate path elements.<\/p>\n<h4>Syntax:<\/h4>\n<p>CALL os.Path.pathseparator() RETURNING <em>separator<\/em> STRING<\/p>\n<h4>Notes:<\/h4>\n<ol>\n<li><em>separator<\/em> contains the path separator.<\/li>\n<li>On Unix, the separator is &#8216;:&#8217;<\/li>\n<li>On Windows, the separator is &#8216;;&#8217;<\/li>\n<\/ol>\n<h4>Usage:<\/h4>\n<p>You typically use this method to build a path from two components.<\/p>\n<h3><a id=\"post-1430-FILE_BASENAME\"><\/a>os.Path.basename<\/h3>\n<h4>Purpose:<\/h4>\n<p>This method returns the last element of a path.<\/p>\n<h4>Syntax:<\/h4>\n<p>CALL os.Path.basename(<em>filename<\/em> STRING) RETURNING <em>basename<\/em> STRING<\/p>\n<h4>Notes:<\/h4>\n<ol>\n<li><em>filename<\/em> is the name of the file.<\/li>\n<li><em>basename<\/em> is the last element of the path.<\/li>\n<\/ol>\n<h4>Usage:<\/h4>\n<p>This method extracts the last component of a path. For example, if you pass &#8220;\/root\/dir1\/file.ext&#8221; as the parameter, it will return &#8220;file.ext&#8221;.<\/p>\n<p>See <a href=\"http:\/\/www.4js.com\/online_documentation\/fjs-fgl-2.11.01-manual-html\/User\/Ext_os_Path.html#EXAMPLE_1#EXAMPLE_1\">Example 1<\/a> for more examples.<\/p>\n<h3><a id=\"post-1430-FILE_DIRNAME\"><\/a>os.Path.dirname<\/h3>\n<h4>Purpose:<\/h4>\n<p>Returns all components of a path excluding the last one.<\/p>\n<h4>Syntax:<\/h4>\n<p>CALL os.Path.dirname(<em>filename<\/em> STRING) RETURNING <em>dirname<\/em> STRING<\/p>\n<h4>Notes:<\/h4>\n<ol>\n<li><em>filename<\/em> is the name of the file.<\/li>\n<li><em>dirname<\/em> contains all the elements of the path excluding the last one.<\/li>\n<\/ol>\n<h4>Usage:<\/h4>\n<p>This method removes the last component of a path. For example, if you pass &#8220;\/root\/dir1\/file.ext&#8221; as the parameter, it will return &#8220;\/root\/dir1&#8221;.<\/p>\n<p>See <a href=\"http:\/\/www.4js.com\/online_documentation\/fjs-fgl-2.11.01-manual-html\/User\/Ext_os_Path.html#EXAMPLE_1#EXAMPLE_1\">Example 1<\/a> for more examples.<\/p>\n<h3><a id=\"post-1430-FILE_ROOTNAME\"><\/a>os.Path.rootname<\/h3>\n<h4>Purpose:<\/h4>\n<p>Returns the file path without the file extension of the last element of the file path.<\/p>\n<h4>Syntax:<\/h4>\n<p>CALL os.Path.rootname(<em>filename<\/em> STRING) RETURNING <em>rootname<\/em> STRING<\/p>\n<h4>Notes:<\/h4>\n<ol>\n<li><em>filename<\/em> is the file path.<\/li>\n<li><em>rootname<\/em> contains the file path without the file extension of the last element.<\/li>\n<\/ol>\n<h4>Usage:<\/h4>\n<p>This method removes the file extension from the path. For example, if you pass &#8220;\/root\/dir1\/file.ext&#8221; as the parameter it will return &#8220;\/root\/dir1\/file&#8221;.<\/p>\n<p>See <a href=\"http:\/\/www.4js.com\/online_documentation\/fjs-fgl-2.11.01-manual-html\/User\/Ext_os_Path.html#EXAMPLE_1#EXAMPLE_1\">Example 1<\/a> for more examples.<\/p>\n<h3><a id=\"post-1430-FILE_JOIN\"><\/a>os.Path.join<\/h3>\n<h4>Purpose:<\/h4>\n<p>Joins two path segments adding the platform-dependent separator.<\/p>\n<h4>Syntax:<\/h4>\n<p>CALL os.Path.join(<em>begin<\/em> STRING, <em>end<\/em> STRING) RETURNING <em>newpath<\/em> STRING<\/p>\n<h4>Notes:<\/h4>\n<ol>\n<li><em>begin<\/em> is the beginning path segment.<\/li>\n<li><em>end<\/em> is the ending path segment.<\/li>\n<li><em>newpath<\/em> contains the joined path segments.<\/li>\n<\/ol>\n<h4>Usage:<\/h4>\n<p>You typically use this method to construct a path with no system-specific code to use the correct path separator:<\/p>\n<p>01 LET path = os.Path.join(os.Path.homedir(), name)<\/p>\n<p>This method returns the ending path segment if it is an absolute path.<\/p>\n<h3><a id=\"post-1430-FILE_PATHTYPE\"><\/a>os.Path.pathtype<\/h3>\n<h4>Purpose:<\/h4>\n<p>Checks if a path is a relative path or an absolute path.<\/p>\n<h4>Syntax:<\/h4>\n<p>CALL os.Path.pathtype(<em>path<\/em> STRING) RETURNING <em>pathtype<\/em> STRING<\/p>\n<h4>Notes:<\/h4>\n<ol>\n<li><em>path<\/em> is the path to check.<\/li>\n<li><em>pathtype<\/em> can be &#8220;absolute&#8221; if the path is an absolute path, or &#8220;relative&#8221; if the path is a relative path.<\/li>\n<\/ol>\n<h3><a id=\"post-1430-FILE_EXISTS\"><\/a>os.Path.exists<\/h3>\n<h4>Purpose:<\/h4>\n<p>Checks if a file exists.<\/p>\n<h4>Syntax:<\/h4>\n<p>CALL os.Path.exists(<em>fname<\/em> STRING) RETURNING <em>result<\/em> INTEGER<\/p>\n<h4>Notes:<\/h4>\n<ol>\n<li><em>fname<\/em> is the file name.<\/li>\n<li><em>result<\/em> is TRUE if the file exists, FALSE otherwise.<\/li>\n<\/ol>\n<h3><a id=\"post-1430-FILE_EXTENSION\"><\/a>os.Path.extension<\/h3>\n<h4>Purpose:<\/h4>\n<p>Returns the file extension.<\/p>\n<h4>Syntax:<\/h4>\n<p>CALL os.Path.extension(<em>fname<\/em> STRING) RETURNING <em>extension<\/em> STRING<\/p>\n<h4>Notes:<\/h4>\n<ol>\n<li><em>fname<\/em> is the file name.<\/li>\n<li><em>extension<\/em> is the string following the last dot found in <em>fname<\/em>.<\/li>\n<li>If fname does not have an extension, the function returns an empty string.<\/li>\n<\/ol>\n<h3><a id=\"post-1430-FILE_READABLE\"><\/a>os.Path.readable<\/h3>\n<h4>Purpose:<\/h4>\n<p>Checks if a file is readable.<\/p>\n<h4>Syntax:<\/h4>\n<p>CALL os.Path.readable(<em>fname<\/em> STRING) RETURNING <em>result<\/em> INTEGER<\/p>\n<h4>Notes:<\/h4>\n<ol>\n<li><em>fname<\/em> is the file name.<\/li>\n<li><em>result<\/em> is TRUE if the file is readable, FALSE otherwise.<\/li>\n<\/ol>\n<h3><a id=\"post-1430-FILE_WRITABLE\"><\/a>os.Path.writable<\/h3>\n<h4>Purpose:<\/h4>\n<p>Checks if a file is writable.<\/p>\n<h4>Syntax:<\/h4>\n<p>CALL os.Path.writable(<em>fname<\/em> STRING) RETURNING <em>result<\/em> INTEGER<\/p>\n<h4>Notes:<\/h4>\n<ol>\n<li><em>fname<\/em> is the file name.<\/li>\n<li><em>result<\/em> is TRUE if the file is writable, FALSE otherwise.<\/li>\n<\/ol>\n<h3><a id=\"post-1430-FILE_EXECUTABLE\"><\/a>os.Path.executable<\/h3>\n<h4>Purpose:<\/h4>\n<p>Checks if a file is executable.<\/p>\n<h4>Syntax:<\/h4>\n<p>CALL os.Path.executable(<em>fname<\/em> STRING) RETURNING <em>result<\/em> INTEGER<\/p>\n<h4>Notes:<\/h4>\n<ol>\n<li><em>fname<\/em> is the file name.<\/li>\n<li><em>result<\/em> is TRUE if the file is executable, FALSE otherwise.<\/li>\n<\/ol>\n<h3><a id=\"post-1430-FILE_ISFILE\"><\/a>os.Path.isfile<\/h3>\n<h4>Purpose:<\/h4>\n<p>Checks if a file is a regular file.<\/p>\n<h4>Syntax:<\/h4>\n<p>CALL os.Path.isfile(<em>fname<\/em> STRING) RETURNING <em>result<\/em> INTEGER<\/p>\n<h4>Notes:<\/h4>\n<ol>\n<li><em>fname<\/em> is the file name.<\/li>\n<li><em>result<\/em> is TRUE if the file is a regular file, FALSE otherwise.<\/li>\n<\/ol>\n<h3><a id=\"post-1430-FILE_ISDIRECTORY\"><\/a>os.Path.isdirectory<\/h3>\n<h4>Purpose:<\/h4>\n<p>Checks if a file is a directory.<\/p>\n<h4>Syntax:<\/h4>\n<p>CALL os.Path.isdirectory(<em>fname<\/em> STRING) RETURNING <em>result<\/em> INTEGER<\/p>\n<h4>Notes:<\/h4>\n<ol>\n<li><em>fname<\/em> is the file name.<\/li>\n<li><em>result<\/em> is TRUE if the file is a directory, FALSE otherwise.<\/li>\n<\/ol>\n<h3><a id=\"post-1430-FILE_ISHIDDEN\"><\/a>os.Path.ishidden<\/h3>\n<h4>Purpose:<\/h4>\n<p>Checks if a file is hidden.<\/p>\n<h4>Syntax:<\/h4>\n<p>CALL os.Path.ishidden(<em>fname<\/em> STRING) RETURNING <em>result<\/em> INTEGER<\/p>\n<h4>Notes:<\/h4>\n<ol>\n<li><em>fname<\/em> is the file name.<\/li>\n<li><em>result<\/em> is TRUE if the file is hidden, FALSE otherwise.<\/li>\n<\/ol>\n<h3><a id=\"post-1430-FILE_ISLINK\"><\/a>os.Path.islink<\/h3>\n<h4>Purpose:<\/h4>\n<p>Checks if a file is UNIX symbolic link.<\/p>\n<h4>Syntax:<\/h4>\n<p>CALL os.Path.islink(<em>fname<\/em> STRING) RETURNING <em>result<\/em> INTEGER<\/p>\n<h4>Notes:<\/h4>\n<ol>\n<li><em>fname<\/em> is the file name.<\/li>\n<li><em>result<\/em> is TRUE if the file is a symbolic link, FALSE otherwise.<\/li>\n<\/ol>\n<p><strong>Warning: This method can only be used on UNIX!<\/strong><\/p>\n<h3><a id=\"post-1430-FILE_ISROOT\"><\/a>os.Path.isroot<\/h3>\n<h4>Purpose:<\/h4>\n<p>Checks if a file path is a root path.<\/p>\n<h4>Syntax:<\/h4>\n<p>CALL os.Path.isroot(<em>path<\/em> STRING) RETURNING <em>result<\/em> STRING<\/p>\n<h4>Notes:<\/h4>\n<ol>\n<li><em>path<\/em> is the path to check.<\/li>\n<li><em>result<\/em> is TRUE if the path is a root path, FALSE otherwise.<\/li>\n<li>On Unix the root path is &#8216;\/&#8217;<\/li>\n<li>On Windows the root path matches &#8220;[a-zA-Z]:\\&#8221;<\/li>\n<\/ol>\n<h3><a id=\"post-1430-FILE_TYPE\"><\/a>os.Path.type<\/h3>\n<h4>Purpose:<\/h4>\n<p>Returns the file type as a string<\/p>\n<h4>Syntax:<\/h4>\n<p>CALL os.Path.type(<em>fname<\/em> STRING) RETURNING <em>ftype<\/em> STRING<\/p>\n<h4>Notes:<\/h4>\n<ol>\n<li><em>fname<\/em> is the file name.<\/li>\n<li><em>ftype<\/em> can be one of:\n<ol>\n<li>file : the file is a regular file<\/li>\n<li>directory : the file is a directory<\/li>\n<li>socket : the file is a socket<\/li>\n<li>fifo : the file is a fifo<\/li>\n<li>block : the file is a block device<\/li>\n<li>char : the file is a character device<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<p><strong>Warning: On UNIX, this method follows symbolic links. You must use the islink() method to identify symbolic links.<\/strong><\/p>\n<h3><a id=\"post-1430-FILE_SIZE\"><\/a>os.Path.size<\/h3>\n<h4>Purpose:<\/h4>\n<p>Returns the size of a file.<\/p>\n<h4>Syntax:<\/h4>\n<p>CALL os.Path.size(<em>fname<\/em> STRING) RETURNING <em>size<\/em> INTEGER<\/p>\n<h4>Notes:<\/h4>\n<ol>\n<li><em>fname<\/em> is the file name.<\/li>\n<li><em>size<\/em> is the file size<\/li>\n<\/ol>\n<h3><a id=\"post-1430-FILE_ATIME\"><\/a>os.Path.atime<\/h3>\n<h4>Purpose:<\/h4>\n<p>Returns the time of the last file access.<\/p>\n<h4>Syntax:<\/h4>\n<p>CALL os.Path.atime(<em>fname<\/em> STRING) RETURNING <em>atime<\/em> STRING<\/p>\n<h4>Notes:<\/h4>\n<ol>\n<li><em>fname<\/em> is the name of the file.<\/li>\n<li><em>atime<\/em> is a string containing the last access time for the specified file in the standard format &#8216;YYYY-MM-DD HH:MM:SS&#8217;.<\/li>\n<li>If the function failed, it returns NULL.<\/li>\n<\/ol>\n<h3><a id=\"post-1430-FILE_MTIME\"><\/a>os.Path.mtime<\/h3>\n<h4>Purpose:<\/h4>\n<p>Returns the time of the last file modification.<\/p>\n<h4>Syntax:<\/h4>\n<p>CALL os.Path.mtime(<em>fname<\/em> STRING) RETURNING <em>mtime<\/em> STRING<\/p>\n<h4>Notes:<\/h4>\n<ol>\n<li><em>fname<\/em> is the name of the file.<\/li>\n<li><em>mtime<\/em> is a string containing the last modification time for the specified file in the standard format &#8216;YYYY-MM-DD HH:MM:SS&#8217;.<\/li>\n<li>If the function failed, it returns NULL.<\/li>\n<\/ol>\n<h3><a id=\"post-1430-FILE_RWX\"><\/a>os.Path.rwx<\/h3>\n<h4>Purpose:<\/h4>\n<p>Returns the UNIX file permissions of a file.<\/p>\n<h4>Syntax:<\/h4>\n<p>CALL os.Path.rwx(<em>fname<\/em> STRING) RETURNING <em>mode<\/em> INTEGER<\/p>\n<h4>Notes:<\/h4>\n<ol>\n<li><em>fname<\/em> is the name of the file.<\/li>\n<li><em>mode<\/em> is the combination of permissions for user, group and other.<\/li>\n<li>Function returns -1 if it fails to get the permissions.<\/li>\n<\/ol>\n<p><strong>Warning: This method can only be used on UNIX!<\/strong><\/p>\n<h4>Usage:<\/h4>\n<p>The <em>mode<\/em> is returned as a decimal value which is the combination of read, write and execution bits for the user, group and other part of the UNIX file permission. For example, if a file has the -rwxr-xr-x permissions, you get ( (4+2+1) * 64 + (4+1) * 8) + (4+1) ) = 493 from this method.<\/p>\n<h3><a id=\"post-1430-FILE_CHRWX\"><\/a>os.Path.chrwx<\/h3>\n<h4>Purpose:<\/h4>\n<p>Changes the UNIX permissions of a file.<\/p>\n<h4>Syntax:<\/h4>\n<p>CALL os.Path.chrwx(<em>fname<\/em> STRING, <em>mode<\/em> INTEGER) RETURNING <em>res<\/em> INTEGER<\/p>\n<h4>Notes:<\/h4>\n<ol>\n<li><em>fname<\/em> is the name of the file.<\/li>\n<li><em>mode<\/em> is the UNIX permission combination in decimal (not octal!).<\/li>\n<li>Function returns TRUE on success, FALSE otherwise.<\/li>\n<\/ol>\n<p><strong>Warning: This method can only be used on UNIX!<\/strong><\/p>\n<h4>Usage:<\/h4>\n<p>The <em>mode<\/em> must be a decimal value which is the combination of read, write and execution bits for the user, group and other part of the UNIX file permission. Make sure to pass the <em>mode<\/em> as the decimal version of permissions, not as octal (the chrwx UNIX command takes an octal value as parameter). For example, to set -rw-r&#8211;r&#8211; permissions, you must pass ( ((4+2) * 64) + (4 * 8) + 4 ) = 420 to this method.<\/p>\n<h3><a id=\"post-1430-FILE_CHOWN\"><\/a>os.Path.chown<\/h3>\n<h4>Purpose:<\/h4>\n<p>Changes the UNIX owner and group of a file.<\/p>\n<h4>Syntax:<\/h4>\n<p>CALL os.Path.chown(<em>fname<\/em> STRING, uid INT, gui INT) RETURNING <em>res<\/em> INTEGER<\/p>\n<h4>Notes:<\/h4>\n<ol>\n<li><em>fname<\/em> is the name of the file.<\/li>\n<li><em>uid<\/em> is the user id.<\/li>\n<li>gui is the group id.<\/li>\n<li>Function returns TRUE on success, FALSE otherwise.<\/li>\n<\/ol>\n<p><strong>Warning: This method can only be used on UNIX!<\/strong><\/p>\n<h3><a id=\"post-1430-FILE_UID\"><\/a>os.Path.uid<\/h3>\n<h4>Purpose:<\/h4>\n<p>Returns the UNIX user id of a file.<\/p>\n<h4>Syntax:<\/h4>\n<p>CALL os.Path.uid(<em>fname<\/em> STRING) RETURNING <em>id<\/em> INTEGER<\/p>\n<h4>Notes:<\/h4>\n<ol>\n<li><em>fname<\/em> is the name of the file.<\/li>\n<li><em>id<\/em> is the user id.<\/li>\n<li>Function returns -1 if it fails to get the user id.<\/li>\n<\/ol>\n<p><strong>Warning: This method can only be used on UNIX!<\/strong><\/p>\n<h3><a id=\"post-1430-FILE_GID\"><\/a>os.Path.gid<\/h3>\n<h4>Purpose:<\/h4>\n<p>Returns the UNIX group id of a file.<\/p>\n<h4>Syntax:<\/h4>\n<p>CALL os.Path.gid(<em>fname<\/em> STRING) RETURNING <em>id<\/em> INTEGER<\/p>\n<h4>Notes:<\/h4>\n<ol>\n<li><em>fname<\/em> is the name of the file.<\/li>\n<li><em>id<\/em> is the group id.<\/li>\n<li>Function returns -1 if it fails to get the user id.<\/li>\n<\/ol>\n<p><strong>Warning: This method can only be used on UNIX!<\/strong><\/p>\n<h3><a id=\"post-1430-FILE_HOMEDIR\"><\/a>os.Path.homedir<\/h3>\n<h4>Purpose:<\/h4>\n<p>Returns the path to the HOME directory of the current user.<\/p>\n<h4>Syntax:<\/h4>\n<p>CALL os.Path.homedir() RETURNING <em>homedir<\/em> STRING<\/p>\n<h4>Notes:<\/h4>\n<ol>\n<li><em>homedir<\/em> Path to the HOME directory of the user.<\/li>\n<\/ol>\n<h3><a id=\"post-1430-FILE_ROOTDIR\"><\/a>os.Path.rootdir<\/h3>\n<h4>Purpose:<\/h4>\n<p>Returns the root directory of the current working path.<\/p>\n<h4>Syntax:<\/h4>\n<p>CALL os.Path.rootdir() RETURNING <em>rootdir<\/em> STRING<\/p>\n<h4>Notes:<\/h4>\n<ol>\n<li><em>rootdir<\/em> is the root directory of the current working path.<\/li>\n<li>On Unix, it always returns &#8216;\/&#8217;<\/li>\n<li>On Windows it returns the current working drive as &#8220;[a-zA-Z]:\\&#8221;<\/li>\n<\/ol>\n<h3><a id=\"post-1430-FILE_DIRFMASK\"><\/a>os.Path.dirfmask<\/h3>\n<h4>Purpose:<\/h4>\n<p>Defines a filter mask for <a href=\"http:\/\/www.4js.com\/online_documentation\/fjs-fgl-2.11.01-manual-html\/User\/Ext_os_Path.html#FILE_DIROPEN#FILE_DIROPEN\">diropen<\/a>.<\/p>\n<h4>Syntax:<\/h4>\n<p>CALL os.Path.dirfmask(<em>mask<\/em> INTEGER)<\/p>\n<h4>Notes:<\/h4>\n<ol>\n<li><em>mask<\/em> defines the filter mask (see below for possible values).<\/li>\n<\/ol>\n<h4>Usage:<\/h4>\n<p>When you call this function, you define the filter mask for any subsequent <a href=\"http:\/\/www.4js.com\/online_documentation\/fjs-fgl-2.11.01-manual-html\/User\/Ext_os_Path.html#FILE_DIROPEN#FILE_DIROPEN\">diropen<\/a> call.<\/p>\n<p>By default, all kinds of directory entries are selected by the <a href=\"http:\/\/www.4js.com\/online_documentation\/fjs-fgl-2.11.01-manual-html\/User\/Ext_os_Path.html#FILE_DIROPEN#FILE_DIROPEN\">diropen<\/a> function. You can restrict the number of entries by using a filter mask.<\/p>\n<p>The parameter of the dirfmask function must be a combination of the following bits:<\/p>\n<ul>\n<li>0x01 = Exclude hidden files (.*)<\/li>\n<li>0x02 = Exclude directories<\/li>\n<li>0x04 = Exclude symbolic links<\/li>\n<li>0x08 = Exclude regular files<\/li>\n<\/ul>\n<p>For example, to retrieve only regular files, you must call:<\/p>\n<p>01 CALL os.Path.dirfmask( 1 + 2 + 4 )<\/p>\n<h3><a id=\"post-1430-FILE_DIRSORT\"><\/a>os.Path.dirsort<\/h3>\n<h4>Purpose:<\/h4>\n<p>Defines the sort criteria and sort order for <a href=\"http:\/\/www.4js.com\/online_documentation\/fjs-fgl-2.11.01-manual-html\/User\/Ext_os_Path.html#FILE_DIROPEN#FILE_DIROPEN\">diropen<\/a>.<\/p>\n<h4>Syntax:<\/h4>\n<p>CALL os.Path.dirsort(<em>criteria<\/em> STRING, <em>order<\/em> INTEGER)<\/p>\n<h4>Notes:<\/h4>\n<ol>\n<li><em>criterie<\/em> is the sort criteria (see below for possible values).<\/li>\n<li><em>order<\/em> defines ascending (1) or descending (-1) order.<\/li>\n<\/ol>\n<h4>Usage:<\/h4>\n<p>When you call this function, you define the sort criteria and sort order for any subsequent <a href=\"http:\/\/www.4js.com\/online_documentation\/fjs-fgl-2.11.01-manual-html\/User\/Ext_os_Path.html#FILE_DIROPEN#FILE_DIROPEN\">diropen<\/a> call.<\/p>\n<p>The <em>criteria<\/em> parameter must be one of the following strings:<\/p>\n<ul>\n<li>&#8220;undefined&#8221; = No sort. This is the default. Entries are read as returned by the OS functions.<\/li>\n<li>&#8220;name&#8221; = Sort by file name.<\/li>\n<li>&#8220;size&#8221; = Sort by file size.<\/li>\n<li>&#8220;type&#8221; = Sort by file type (directory, link, regular file).<\/li>\n<li>&#8220;atime&#8221; = Sort by access time.<\/li>\n<li>&#8220;ctime&#8221; = Sort by modification time.<\/li>\n<li>&#8220;extension&#8221; = Sort by file extension.<\/li>\n<\/ul>\n<p>When sorting by name, directory entries will be ordered according to the <a href=\"http:\/\/www.4js.com\/online_documentation\/fjs-fgl-2.11.01-manual-html\/User\/Localization.html\">current locale<\/a>.<\/p>\n<p>When sorting by any criteria other than the file name, entries having the same value for the given criteria are ordered by name in ascending order.<\/p>\n<h3><a id=\"post-1430-FILE_DIROPEN\"><\/a>os.Path.diropen<\/h3>\n<h4>Purpose:<\/h4>\n<p>Opens a directory and returns an integer handle to this directory.<\/p>\n<h4>Syntax:<\/h4>\n<p>CALL os.Path.diropen(<em>dname<\/em> STRING) RETURNING <em>dirhandle<\/em> INTEGER<\/p>\n<h4>Notes:<\/h4>\n<ol>\n<li><em>dname<\/em> is the name of the directory.<\/li>\n<li><em>dirhandle<\/em> is the directory handle. A dirhandle value of 0 indicates a failure when opening the directory.<\/li>\n<\/ol>\n<h4>Usage:<\/h4>\n<p>This function creates a list of directory<\/p>\n<p><em>See also:<\/em> <a href=\"http:\/\/www.4js.com\/online_documentation\/fjs-fgl-2.11.01-manual-html\/User\/Ext_os_Path.html#FILE_DIRFMASK#FILE_DIRFMASK\">dirfmask<\/a>, <a href=\"http:\/\/www.4js.com\/online_documentation\/fjs-fgl-2.11.01-manual-html\/User\/Ext_os_Path.html#FILE_DIRSORT#FILE_DIRSORT\">dirsort<\/a><\/p>\n<h3><a id=\"post-1430-FILE_DIRCLOSE\"><\/a>os.Path.dirclose<\/h3>\n<h4>Purpose:<\/h4>\n<p>Closes the directory referenced by the directory handle <em>dirhandle<\/em>.<\/p>\n<h4>Syntax:<\/h4>\n<p>CALL os.Path.dirclose(<em>dirhandle<\/em> INTEGER)<\/p>\n<h4>Notes:<\/h4>\n<ol>\n<li><em>dirhandle<\/em> is the directory handle of the directory to close.<\/li>\n<\/ol>\n<h3><a id=\"post-1430-FILE_DIRNEXT\"><\/a>os.Path.dirnext<\/h3>\n<h4>Purpose:<\/h4>\n<p>Reads the next entry in the directory.<\/p>\n<h4>Syntax:<\/h4>\n<p>CALL os.Path.dirnext(<em>dirhandle<\/em> INTEGER) RETURNING <em>direntry<\/em> STRING<\/p>\n<h4>Notes:<\/h4>\n<ol>\n<li><em>dirhandle<\/em> is the directory handle of the directory to read.<\/li>\n<li><em>direntry<\/em> is the name of the entry read or NULL if all entries have been read.<\/li>\n<\/ol>\n<h3><a id=\"post-1430-FILE_PWD\"><\/a>os.Path.pwd<\/h3>\n<h4>Purpose:<\/h4>\n<p>Returns the current working directory.<\/p>\n<h4>Syntax:<\/h4>\n<p>CALL os.Path.pwd() RETURNING <em>cwd<\/em> STRING<\/p>\n<h4>Notes:<\/h4>\n<ol>\n<li><em>cwd<\/em> is the current working directory.<\/li>\n<\/ol>\n<h3><a id=\"post-1430-FILE_CHDIR\"><\/a>os.Path.chdir<\/h3>\n<h4>Purpose:<\/h4>\n<p>Changes the current working directory.<\/p>\n<h4>Syntax:<\/h4>\n<p>CALL os.Path.chdir(<em>newdir<\/em> STRING) RETURNING <em>result<\/em> INTEGER<\/p>\n<h4>Notes:<\/h4>\n<ol>\n<li><em>newdir<\/em> is the directory to select.<\/li>\n<li><em>result<\/em> is TRUE if the current directory could be successfully selected.<\/li>\n<\/ol>\n<h3><a id=\"post-1430-FILE_VOLUMES\"><\/a>os.Path.volumes<\/h3>\n<h4>Purpose:<\/h4>\n<p>Returns the available volumes.<\/p>\n<h4>Syntax:<\/h4>\n<p>CALL os.Path.volumes() RETURNING <em>volumes<\/em> STRING<\/p>\n<h4>Notes:<\/h4>\n<ol>\n<li><em>volumes<\/em> contains the list of all available volumes separated by &#8220;|&#8221;.<\/li>\n<\/ol>\n<h3><a id=\"post-1430-FILE_CHVOLUME\"><\/a>os.Path.chvolume<\/h3>\n<h4>Purpose:<\/h4>\n<p>Changes the current working volume.<\/p>\n<h4>Syntax:<\/h4>\n<p>CALL os.Path.chvolume(<em>newvolume<\/em> STRING) RETURNING <em>result<\/em> INTEGER<\/p>\n<h4>Notes:<\/h4>\n<ol>\n<li><em>newvolume<\/em> is the volume to select as the new current working volume.<\/li>\n<li><em>result<\/em> is TRUE if the current working volume could be successfully changed.<\/li>\n<li>Sample : CALL os.Path.chvolume(&#8220;C:\\\\&#8221;) RETURNING result<\/li>\n<\/ol>\n<h3><a id=\"post-1430-FILE_MKDIR\"><\/a>os.Path.mkdir<\/h3>\n<h4>Purpose:<\/h4>\n<p>Creates a new directory.<\/p>\n<h4>Syntax:<\/h4>\n<p>CALL os.Path.mkdir(<em>dname<\/em> STRING) RETURNING <em>result<\/em> INTEGER<\/p>\n<h4>Notes:<\/h4>\n<ol>\n<li><em>dname<\/em> is the name of the directory to create<\/li>\n<li><em>result<\/em> is TRUE if the directory has been successfully created, FALSE otherwise.<\/li>\n<\/ol>\n<h3><a id=\"post-1430-FILE_DELETE\"><\/a>os.Path.delete<\/h3>\n<h4>Purpose:<\/h4>\n<p>Deletes a file or a directory.<\/p>\n<h4>Syntax:<\/h4>\n<p>CALL os.Path.delete(<em>dname<\/em> STRING) RETURNING <em>result<\/em> INTEGER<\/p>\n<h4>Notes:<\/h4>\n<ol>\n<li><em>fname<\/em> is the name of the file or directory to delete<\/li>\n<li><em>result<\/em> is TRUE if the file or directory has been successfully deleted, FALSE otherwise.<\/li>\n<li>A directory can only be deleted if it is empty.<\/li>\n<\/ol>\n<h3><a id=\"post-1430-FILE_RENAME\"><\/a>os.Path.rename<\/h3>\n<h4>Purpose:<\/h4>\n<p>Renames a file or a directory.<\/p>\n<h4>Syntax:<\/h4>\n<p>CALL os.Path.rename(<em>oldname<\/em> STRING, <em>newname<\/em> STRING) RETURNING <em>result<\/em> INTEGER<\/p>\n<h4>Notes:<\/h4>\n<ol>\n<li><em>oldname<\/em> is the current name of the file or directory to be renamed.<\/li>\n<li><em>newname<\/em> is the new name to assign to the file or directory.<\/li>\n<li><em>result<\/em> is TRUE if the file or directory has been successfully renamed, FALSE otherwise.<\/li>\n<\/ol>\n<h3><a id=\"post-1430-FILE_COPY\"><\/a>os.Path.copy<\/h3>\n<h4>Purpose:<\/h4>\n<p>Copies a regular file or.<\/p>\n<h4>Syntax:<\/h4>\n<p>CALL os.Path.copy(<em>source<\/em> STRING, <em>dest<\/em> STRING) RETURNING <em>result<\/em> INTEGER<\/p>\n<h4>Notes:<\/h4>\n<ol>\n<li><em>source<\/em> is the name of the file to copy.<\/li>\n<li><em>dest<\/em> is the destination name of the copied file.<\/li>\n<li><em>result<\/em> is TRUE if the file has been successfully copied, FALSE otherwise.<\/li>\n<\/ol>\n<h3>Examples:<\/h3>\n<h4>Example 1: Extracting the parts of a file name<\/h4>\n<p>This program uses the file functions to extract the directory name, the base name, the root name, and the file extension:<\/p>\n<p>IMPORT os<\/p>\n<p>MAIN<\/p>\n<p>DISPLAY &#8220;Dir name = &#8220;, os.Path.dirname(arg_val(1))<\/p>\n<p>DISPLAY &#8220;Base name = &#8220;, os.Path.basename(arg_val(1))<\/p>\n<p>DISPLAY &#8220;Root name = &#8220;, os.Path.rootname(arg_val(1))<\/p>\n<p>DISPLAY &#8220;Extension = &#8220;, os.Path.extension(arg_val(1))<\/p>\n<p>END MAIN<\/p>\n<p>Example results:<\/p>\n<table>\n<tbody>\n<tr>\n<td><strong>Path<\/strong><\/td>\n<td><strong>os.Path.dirname<\/strong><\/td>\n<td><strong>os.Path.basename<\/strong><\/td>\n<td><strong>os.Path.rootname<\/strong><\/td>\n<td><strong>os.Path.extension<\/strong><\/td>\n<\/tr>\n<tr>\n<td>.<\/td>\n<td>.<\/td>\n<td>.<\/td>\n<td><\/td>\n<td>NULL<\/td>\n<\/tr>\n<tr>\n<td>..<\/td>\n<td>.<\/td>\n<td>..<\/td>\n<td>.<\/td>\n<td>NULL<\/td>\n<\/tr>\n<tr>\n<td>\/<\/td>\n<td>\/<\/td>\n<td>\/<\/td>\n<td>\/<\/td>\n<td>NULL<\/td>\n<\/tr>\n<tr>\n<td>\/usr\/lib<\/td>\n<td>\/usr<\/td>\n<td>lib<\/td>\n<td>\/usr\/lib<\/td>\n<td>NULL<\/td>\n<\/tr>\n<tr>\n<td>\/usr\/<\/td>\n<td>\/<\/td>\n<td>usr<\/td>\n<td>\/usr\/<\/td>\n<td>NULL<\/td>\n<\/tr>\n<tr>\n<td>usr<\/td>\n<td>.<\/td>\n<td>usr<\/td>\n<td>usr<\/td>\n<td>NULL<\/td>\n<\/tr>\n<tr>\n<td>file.xx<\/td>\n<td>.<\/td>\n<td>file.xx<\/td>\n<td>file<\/td>\n<td>xx<\/td>\n<\/tr>\n<tr>\n<td>\/tmp.yy\/file.xx<\/td>\n<td>\/tmp.yy<\/td>\n<td>file.xx<\/td>\n<td>\/tmp.yy\/file<\/td>\n<td>xx<\/td>\n<\/tr>\n<tr>\n<td>\/tmp.yy\/file.xx.yy<\/td>\n<td>\/tmp.yy<\/td>\n<td>file.xx.yy<\/td>\n<td>\/tmp.yy\/file.xx<\/td>\n<td>yy<\/td>\n<\/tr>\n<tr>\n<td>\/tmp.yy\/<\/td>\n<td>\/<\/td>\n<td>tmp.yy<\/td>\n<td>\/tmp.yy\/<\/td>\n<td>NULL<\/td>\n<\/tr>\n<tr>\n<td>\/tmp.yy\/.<\/td>\n<td>\/tmp.yy<\/td>\n<td>.<\/td>\n<td>\/tmp.yy\/<\/td>\n<td>NULL<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>Warning: The above examples use Unix file names. On Windows the result would be different, as the file name separator is &#8216;\\&#8217;.<\/strong><\/p>\n<h4>Example 2: Browsing directories.<\/h4>\n<p>This program takes a directory path as an argument and scans the content recursively:<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"null\">IMPORT os\r\n\r\nMAIN\r\n\r\nCALL showDir(arg_val(1))\r\n\r\nEND MAIN\r\n\r\nFUNCTION showDir(path)\r\n\r\nDEFINE path STRING\r\n\r\nDEFINE child STRING\r\n\r\nDEFINE h INTEGER\r\n\r\nIF NOT os.Path.exists(path) THEN\r\n\r\nRETURN\r\n\r\nEND IF\r\n\r\nIF NOT os.Path.isdirectory(path) THEN\r\n\r\nDISPLAY \" \", os.Path.basename(path)\r\n\r\nRETURN\r\n\r\nEND IF\r\n\r\nDISPLAY \"[\", path, \"]\"\r\n\r\nCALL os.Path.dirsort(\"name\", 1)\r\n\r\nLET h = os.Path.diropen(path)\r\n\r\nWHILE h &gt; 0\r\n\r\nLET child = os.Path.dirnext(h)\r\n\r\nIF child IS NULL THEN EXIT WHILE END IF\r\n\r\nIF child == \".\" OR child == \"..\" THEN CONTINUE WHILE END IF\r\n\r\nCALL showDir( os.Path.join( path, child ) )\r\n\r\nEND WHILE\r\n\r\nCALL os.Path.dirclose(h)\r\n\r\nEND FUNCTION<\/code><\/pre>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>\u8f6c\u8f7d\u8bf7\u6ce8\u660e\uff1a<a href=\"https:\/\/www.hefeiyu.com\">\u8d6b\u975e\u57df<\/a> &raquo; <a href=\"https:\/\/www.hefeiyu.com\/?p=1430\">Tiptop -Genero \u6280\u4e13\u6ca1\u6559\u7684\u4e8b<\/a><\/p>","protected":false},"excerpt":{"rendered":"<p>Genero \u6280\u8f6c\u6ca1\u6559\u7684\u4e8b (01) \u2013 \u6587\u4ef6\u7cfb\u7edf\u5904\u7406 File Management Class link to 4js.com: Basics Syntax Methods Examples Example 1: Extracting the p [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26],"tags":[159,470,483],"class_list":["post-1430","post","type-post","status-publish","format-standard","hentry","category-4gl","tag-file","tag-genero","tag-483"],"_links":{"self":[{"href":"https:\/\/www.hefeiyu.com\/index.php?rest_route=\/wp\/v2\/posts\/1430","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hefeiyu.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hefeiyu.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hefeiyu.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hefeiyu.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1430"}],"version-history":[{"count":3,"href":"https:\/\/www.hefeiyu.com\/index.php?rest_route=\/wp\/v2\/posts\/1430\/revisions"}],"predecessor-version":[{"id":1433,"href":"https:\/\/www.hefeiyu.com\/index.php?rest_route=\/wp\/v2\/posts\/1430\/revisions\/1433"}],"wp:attachment":[{"href":"https:\/\/www.hefeiyu.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1430"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hefeiyu.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1430"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hefeiyu.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1430"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}