Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add exclude path option in ListDir #21

Closed
edonyzpc opened this issue Sep 27, 2017 · 1 comment
Closed

add exclude path option in ListDir #21

edonyzpc opened this issue Sep 27, 2017 · 1 comment
Assignees
Projects
Milestone

Comments

@edonyzpc
Copy link
Owner

def _listdir(self, path=None, excludepath=None):
        """ list root path recursively including sub-directories
        """
        if self.root is None:
            if path is not None:
                for root_, dir_, file_ in os.walk(path):
                    if root_ == excludepath:
                        continue
                    dir_ctx = []
                    dir_ctx.insert(0, file_)
                    dir_ctx.insert(0, dir_)
                    buf_dl = {}
                    buf_dl[root_] = dir_ctx
                    self._dl_buf.insert(0, buf_dl)
            else:
                raise Exception("Error DirList class initialize")
        else:
            for root_, dir_, file_ in os.walk(self.root):
                if root_ == excludepath:
                    continue
                dir_ctx = []
                dir_ctx.insert(0, file_)
                dir_ctx.insert(0, dir_)
                self.dirlist[root_] = dir_ctx
@edonyzpc edonyzpc added this to the 3.0: NR milestone Sep 27, 2017
@edonyzpc edonyzpc self-assigned this Sep 27, 2017
@edonyzpc
Copy link
Owner Author

finished 811acb3

@edonyzpc edonyzpc added this to ListDir in fileprocess Sep 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

1 participant