File system management

 

Presentation

J has a set of portable primitives (UNIX/Windows) for typical file system management operations.

 

The J stream management services will then be able to access file contents.

 

 

File system services

boolean Object:removeFile(in String name)

Destroys the "name" file.  This returns "true" if the action has been properly carried out, and "false" if this is not the case.

 

boolean Object:moveFile(in String nameOrig, in String nameDest)

Moves the "nameOrig" file to "nameDest".  This returns "true" if the action has been properly carried out, and "false" if this is not the case.

 

boolean Object:copyFile(in String nameOrig, in String nameDest)

Copies the "nameOrig" file to "nameDest".  This returns "true" if the files are identical, and "false" if this is not the case.  If a file has not been found, returns "false".

 

boolean Object:compareFile(in String name1, in String name2)

Compares "name1" with "name2".  This returns "true" if the files are identical, and "false" if this is not the case.  If a file has not been found, returns "false".

 

boolean Object:tmpFileName(out String name)

Calculates a temporary file name in "name".  This returns "true" if the action is properly carried out, and "false" if this is not the case.

 

boolean Object:getFileSize(in String name, out int size)

Returns the size of the "name" file in "size".  This returns "true" if the action is properly carried out, and "false" if this is not the case.

 

boolean Object:mkDir(in String name)

Creates the "name" directory.  This returns "true" if the action has been properly carried out or if the directory already existed, and "false" if this is not the case.

 

boolean Object:mkDirRec(in String name)

Creates the "name" directory and the parent directories if necessary.  This returns "true" if the action has been properly carried out or if the directories already existed, and "false" if this is not the case.

 

boolean Object:rmDir(in String name, in boolean removeContent)

Destroys the "name" directory. If "removeContent" is false, then the directory must be empty, otherwise it must only contain files which will also be deleted.  This returns "true" if the action has been properly carried out, and "false" if this is not the case.

 

boolean Object:rmDirRec(in String name)

Destroys the "name" directory and its contents recursively.  This returns "true" if the action has been properly carried out, and "false" if this is not the case.

 

String Object:getOSFamily()

Indicates the family of the host operating system : "Windows" or "Unix".

 

String[] Object:getFilesInDirectory (in String directory)

This returns the list of files contained in the "directory" directory.

 

boolean Object:getFileTime (in String fileName, out int date)

This retrieves the creation date of the "fileName" file in the "date" variable.  It returns true if the operation has been successfully carried out.

 

Boolean Object:listFile (in String directory, in boolean prependDir, in boolean recursive, in String separator, in boolean withFile, in boolean withDirectory, out String files)

This lists the contents of the "directory" directory in "files". 

·         If "prependDir" is true, directory is concatenated before every entry.

·         If "recursive" is true, the list contains entries in the sub-directories.  "recursive" implies "prependDir".

·         "separator" indicates the separator used to separate file names in "files".  It returns true if the operation has been successfully carried out.

·         "withFile" indicates whether or not files should be returned.

·         "withDirectory" indicates whether or not sub-directories should be returned.