mspt.zip package

Submodules

mspt.zip.zipFiles module

mspt.zip.zipFiles.archiveDataFromListPath(listPath, zipname, goToSubDir=True, listExt=None, rmCommonPath=True)[source]

From given directory and file path create a zip archive.

Parameters:
  • listPath – list of path of files and directories
  • zipname – name of the archive
  • goToSubDir – if True, when the path is a directory list the files in the subdirectories
  • listExt – list of extensions we want add in the zip archive. Files with other extensions won’t be added
  • rmCommonPath – True if you want to remove the common prefixe path to all the files when they are being archived
Returns:

Informative text on the success or the failure.

mspt.zip.zipFiles.createZipArchiveForFiles(listFiles, zipname, rmCommonPath=True)[source]

Creates a zip archive from a list of files.

Parameters:
  • listFiles – list of paths to files
  • zipname – name of the archive
  • rmCommonPath – True if you want to remove the common prefixe path to all the files when they are being archived
Returns:

A list [Bool , String], where bool is True if the zip process was achieved, False otherwise. The string correspond to an informative message.

mspt.zip.zipFiles.getFileListForDirectory(dirPath, visitSubDir=True, listExt=None)[source]

Creates a list of files from a directory path: the files are in the directory or its subdirectories.

Parameters:
  • dirPath – path to the directory
  • visitSubDir – True if we list the files contained in the subdirectories
  • listExt – list of extensions, if we want to list only files with given extensions
Returns:

A list of files.

Module contents