Map a Directory

Use the map_directory() method to add .directory_map to the start object. This is a dictionary with keys that are the directories and values that are lists of filenames found in the directories,

import lsframe as ls

lsobject.map_directory()
_images/dir_map.png

.directory_map

The map_directory() method can also deal with hidden or empty directories, and you may also toggle the os.walk topdown option. The available arguments are:

def map_directory(directory=None,
                  skip=[],
                  skip_empty=False,
                  skip_hidden=True,
                  only_hidden=False,
                  walk_topdown=True,
                  ):

If a start object is instantiated without a directory attribute, specify the directory to map using the keyword arg directory= to get the same behavior,

lsobject.map_directory(directory='path/to/directory')