Skip to content

Commit

Permalink
modules: files: add ls_dir function
Browse files Browse the repository at this point in the history
  • Loading branch information
machacekondra committed Oct 12, 2015
1 parent 6273019 commit fe868a1
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions winremote/modules/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,17 @@ def exists(session, path):
:rtype: bool
"""
return session.run_cmd('dir /b "%s"' % path)[0]


def ls_dir(session, path):
"""
List content of directory
:param session: instance of Windows, which hold session to win machine
:type session: winremote.Windows
:param path: directory path
:type path: str
:returns: list of files and direcotries in directory at @path
:rtype: list
"""
return session.run_cmd('dir /b "%s"' % path)[1].split('\r\n')[:-1]

0 comments on commit fe868a1

Please sign in to comment.