pycatia.in_interfaces.file_system¶
Module initially auto generated using V5Automation files from CATIA V5 R28 on 2020-06-11 12:40:47.360445
Warning
The notes denoted “CAA V5 Visual Basic Help” are to be used as reference only. They are there as a guide as to how the visual basic / catscript functions work and thus help debugging in pycatia.
- class pycatia.in_interfaces.file_system.FileSystem(com_object)¶
Note
CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445)
System.IUnknownSystem.IDispatchSystem.CATBaseUnknownSystem.CATBaseDispatchSystem.AnyObjectFileSystemRepresents the file system object.Role: The file system object allows you to access and manipulate folders andfiles. It can check the existence of, get, create, delete, or copy folders andfiles.See also:Folder, File- concatenate_paths(i_path_chunk1: str, i_path_chunk2: str) str ¶
Note
- CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445))
- o Func ConcatenatePaths(CATBSTR iPathChunk1,CATBSTR iPathChunk2) As CATBSTRConcatenates two path chunks to make a new path. Either path chunk can beempty. The resulting path does not have to exist. The method automaticallycorrects improper path separators (/ Unix separators used on a Windows platformare automatically replaced by // and vice versa).Parameters:iPathChunk1The first path chunk (for instance “E://tmp”).iPathChunk2The second path chunk (for instance “local/myfile.txt”).oPathThe resulting path (for instance“E://tmp//local//myfile.txt”).
- Parameters:
i_path_chunk1 (str) –
i_path_chunk2 (str) –
- Return type:
str
- copy_file(i_path_source: str, i_path_destination: str, i_overwrite: bool) None ¶
Note
- CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445))
- o Sub CopyFile(CATBSTR iPathSource,CATBSTR iPathDestination,boolean iOverwrite)Copies a file from one location to another.Parameters:iSourcePathThe full path of the source file.iDestinationPathThe full destination path where the source file is to be copied.iOverwriteBoolean value that is True if an existing file with the same namecan be overwritten; False if it is not, and the copy doesn’t takeplace.Example:This example copies the file C:/Tests/File1 to C:/Tests/File2from the file system object FileSys, except if a file with the nameC:/Tests/File2 already exists.FileSys.CopyFile(“C:/Tests/File1”, “C:/Tests/File2”,False)
- Parameters:
i_path_source (str) –
i_path_destination (str) –
i_overwrite (bool) –
- Return type:
None
- copy_folder(i_source_path: str, i_destination_path: str) None ¶
Note
- CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445))
- o Sub CopyFolder(CATBSTR iSourcePath,CATBSTR iDestinationPath)Recursively copies a folder from one location to another. Role: The folderis copied along with its files, and all its subfolders and their ownfiles.Parameters:iSourcePathThe full path of the source folder.iDestinationPathThe full destination path where the source folder, its files, andits subfolders are to be copied.Example:This example copies the folder “C:/Tests/Fold1” to“C:/Tests/Fold2” of the file system objectFileSys.FileSys.CopyFolder(“C:/Tests/Fold1”,“C:/Tests/Fold2”)
- Parameters:
i_source_path (str) –
i_destination_path (str) –
- Return type:
None
- create_file(i_path: str, i_overwrite: bool) File ¶
Note
- CAA V5 Visual Basic Help (2020-07-06 14:02:20.222384))
- o Func CreateFile(CATBSTR iPath,boolean iOverwrite) As FileCreates a file and returns the associated file object.Parameters:iPathThe full path where the file is to be created.iOverwriteBoolean value that is True if an existing file with the same namecan be overwritten; False if it is not, and the creation doesn’t take place.Returns:The created fileExample:This example creates the file C:/Tests/File1 and retrieves it inthe file object FileObj from the file system object FileSys, except if a filewith the name C:/Tests/File1 already exists.Dim FileObj As FileSet FileObj = FileSys.CreateFile(“C:/Tests/File1”, False)
- Parameters:
i_path (str) –
i_overwrite (bool) –
- Return type:
- create_folder(i_path: str) Folder ¶
Note
- CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445))
- o Func CreateFolder(CATBSTR iPath) As FolderCreates a folder and returns the associated folder object.Parameters:iPathThe full path where the folder is to be created.Returns:The created folder object. If the folder already exists, the methodfails.Example:This example creates the folder “C:/Tests/Fold1” and retrieves itin FoldObj from the FileSystem FileSys.Dim FoldObj As FolderSet FoldObj = FileSys.CreateFolder(“C:/Tests/Fold1”)
- Parameters:
i_path (str) –
- Return type:
- delete_file(i_path: str) None ¶
Note
- CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445))
- o Sub DeleteFile(CATBSTR iPath)Deletes a file.The method fails if the folder doesn’t exist.Parameters:iPathThe full path of the file to delete.Example:This example deletes the file “C:/Tests/File” from the filesystem object FileSys.FileSys.DeleteFile(“C:/Tests/File1”)
- Parameters:
i_path (str) –
- Return type:
None
- delete_folder(i_path: str) None ¶
Note
- CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445))
- o Sub DeleteFolder(CATBSTR iPath)Deletes a folder.The method fails if the folder doesn’t exist.Parameters:iPathThe full path of the folder to delete.Example:This example deletes the folder “C:/Tests/Fold1” from theFileSystem FileSys.FileSys.DeleteFolder(“C:/Tests/Fold1”)
- Parameters:
i_path (str) –
- Return type:
None
- file_exists(i_path: str) bool ¶
Note
- CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445))
- o Func FileExists(CATBSTR iPath) As booleanReturns whether a given file exists.True if the file exists.Parameters:iPathThe full path of the file.Example:This example retrieves in Exists whether the file“C:/Tests/File1” exists in the file system objectFileSys.Dim Exists As BooleanExists = FileSys.FileExists(“C:/Tests/File1”)
- Parameters:
i_path (str) –
- Return type:
bool
- property file_separator: str¶
Note
- CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445)
- o Property FileSeparator() As CATBSTR (Read Only)Returns the file separator string. (usually, // on Windows and / onUNIX)Parameters:oTmpDirectoryThe file separator string.
- Return type:
str
- folder_exists(i_path: str) bool ¶
Note
- CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445))
- o Func FolderExists(CATBSTR iPath) As booleanReturns whether a given folder exists.True if the folder exists.Parameters:iPathThe full path of the folder.Example:This example retrieves in Exists whether the folder“C:/Tests/Fold1” exists in the file system objectFileSys.Dim Exists As BooleanExists=FileSys.FolderExists(“C:/Tests/Fold1”)
- Parameters:
i_path (str) –
- Return type:
bool
- get_file(i_path: str) File ¶
Note
- CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445))
- o Func GetFile(CATBSTR iPath) As FileReturns a file using its full path.The method fails if the folder doesn’t exist.Parameters:iPathThe full path of the file to retrieve.Example:This example retrieves the file C:/Tests in the FileObj fromthe file system object FileSys.Dim FileObj As FileSet FileObj = FileSys.GetFile(“C:/Tests”)
- Parameters:
i_path (str) –
- Return type:
- get_folder(i_path: str) Folder ¶
Note
- CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445))
- o Func GetFolder(CATBSTR iPath) As FolderReturns a folder using its full path.Parameters:iPathThe full path of the folder to retrieve.Returns:The retrieved folder. If the folder doesn’t exist, the methodfails.Example:This example retrieves the C:Tests folder in FoldObj from the filesystem object FileSys.Dim FoldObj As FolderSet FoldObj = FileSys.GetFolder(“C:/Tests/”)
- Parameters:
i_path (str) –
- Return type:
- property path_separator: str¶
Note
- CAA V5 Visual Basic Help (2020-07-06 14:02:20.222384)
- o Property PathSeparator() As CATBSTR (Read Only)Returns the path separator string. (usually,; on Windows and : on UNIX)Parameters:oTmpDirectoryThe path separator string.
- Return type:
str
- property temporary_directory: Folder¶
Note
- CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445)
- o Property TemporaryDirectory() As Folder (Read Only)Returns the temporary system directory. (usually, C://temp on Windows and/tmp on UNIX)Parameters:oTmpDirectoryA folder which corresponds to the temporary systemdirectory.
- Return type: