OPSI.System package

Module contents

System library.

This library holds functionality to work with different operating systems. For the every day use you should import the method / class you want to use directly from this module. Because most functions are implemented for Windows and POSIX systems you should end up with runnable commands.

author:Jan Schneider <j.schneider@uib.de>
author:Niko Wenselowski <n.wenselowski@uib.de>
license:GNU Affero General Public License version 3
class OPSI.System.SystemHook

Bases: OPSI.System.Posix.SystemSpecificHook

error_copy(src, dst, progressSubject, exception)
error_countFiles(path, result, exception)
error_getCountAndSize(path, result, exception)
error_getDirectorySize(path, result, exception)
error_getSize(path, result, exception)
post_copy(src, dst, progressSubject)
post_countFiles(path, result)
post_getCountAndSize(path, result)
post_getDirectorySize(path, result)
post_getSize(path, result)
pre_copy(src, dst, progressSubject)
pre_countFiles(path)
pre_getCountAndSize(path)
pre_getDirectorySize(path)
pre_getSize(path)
OPSI.System.copy(src, dst, progressSubject=None)

Copy from src to dst.

The copy process will follow these rules:

  • src = file, dst = file: overwrite dst
  • src = file, dst = dir: copy into dst
  • src = file, dst = not existent: create dst directories, copy src to dst
  • src = dir, dst = file: Exception
  • src = dir, dst = dir: copy src dir into dst
  • src = dir, dst = not existent: create dst, copy content of src into dst
  • src = dir/*, dst = dir/not existent: create dst if not exists, copy content of src into dst
OPSI.System.countFiles(path)
OPSI.System.getCountAndSize(path)
OPSI.System.getDirectorySize(path)
OPSI.System.getSize(path)
OPSI.System.mkdir(newDir, mode=488)

Create a new directory.

If newDir is a already existing directory this will complete silently. If newDir is a file an exception will be risen. If parent directories do not exist they are created aswell.