Bases: fs.Entry
Flag this directory so that any new files are automatically compressed. If apply_to_contents is True, iterate over all subdirectories and their files, compressing likewise.
Parameters: |
|
---|---|
Returns: | this directory |
Copy this directory to another, which must be a directory if it exists. If it does exist, this directory’s contents will be copied inside it; if it does not exist, this directory will become it. NB To copy this directory inside another, set the target_filepath to other_directory + self.name.
Parameters: |
|
---|---|
Returns: | a Dir object representing target_filepath |
Create this directory, optionally specifying a security descriptor. If the directory already exists, silently succeed. All intervening directories are automatically created if they do not already exist. If any exists but is a file rather than a directory, an exception is raised.
Parameters: | security_descriptor – anything accepted by security.security() |
---|---|
Returns: | a Dir representing the newly-created directory |
Delete this directory, optionally including its children.
Parameters: | recursive – whether to remove all subdirectories and files first |
---|---|
Returns: | this Dir |
Iterate over all directories in this directory which match pattern, yielding a Dir object for each one. Implemented via Dir.entries().
Parameters: | pattern – a |-separated list of wildcards to match |
---|
Iterate over all entries – files & directories – in this directory. Implemented via files()
Parameters: | pattern – a |-separated list of wildcards to match |
---|
Iterate over all files in this directory which match pattern, yielding a File object for each one. Implemented via Dir.entries().
Parameters: | pattern – a |-separated list of wildcards to match |
---|
Iterate over this directory and all its subdirectories, yielding one File object on each iteration, and optionally Dir objects as well.
Parameters: | pattern – limit the files returned by filename |
---|---|
Includedirs : | whether to yield directories as well as files [False] |
Depthfirst : | as for Dir.walk() |
Error_handler : | as for Dir.walk() |
Returns True if this directory is empty, False otherwise. Will fail if the directory does not yet exist.
Create :dirname: as a subdirectory of this directory, specifying a security descriptor. This is implemented in terms of create() by concatenating this directory and dirname and calling .create on the resulting Dir object.
Parameters: |
|
---|---|
Returns: | a Dir representing the newly-created directory |
Mount a volume on this directory. The directory must be empty or an exception is raised. eg:
from winsys import fs
fs.dir ("c:/temp").mkdir ("c_drive").mount ("c:")
Parameters: | vol – anything accepted by volume() |
---|---|
Returns: | this Dir |
Delete this directory, optionally including its children.
Parameters: | recursive – whether to remove all subdirectories and files first |
---|---|
Returns: | this Dir |
Flag this directory so that any new files are automatically not compressed. If apply_to_contents is True, iterate over all subdirectories and their files, uncompressing likewise.
Parameters: |
|
---|---|
Returns: | this directory |
Mimic os.walk, iterating over each directory and the files within in. Each iteration yields:
Parameters: |
|
---|
Zip the directory up into a zip file. By default, the file will have the name of the directory with ”.zip” appended and will be a sibling of the directory. Also by default a new zipfile will be created, overwriting any existing one, and standard compression will be used. Filenames are stored as relative to this dir.
A different zip filename can be specific as the zip_filename parameter, and this can be appended to (if it exists) by specifying “a” as the mode param.
The created / appended zip file is returned.
Parameters: |
|
---|---|
Returns: | a File object representing the resulting zip file |