forked from xenomachina/adbsync
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b3da7b3
commit d5ee845
Showing
1 changed file
with
11 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,7 +41,7 @@ def touch(fname, dt=None): | |
with file(fname, 'a'): | ||
os.utime(fname, dt) | ||
|
||
LS_LINE_REGEX = re.compile(r'(..........)\s+(\w+)\s+(\w+)\s+(\d+)\s+(\d\d\d\d-\d\d-\d\d \d\d:\d\d)\s+(.+)$') | ||
LS_LINE_REGEX = re.compile(r'(..........)\s+(\w+)\s+(\w+)\s+(\d*)\s+(\d\d\d\d-\d\d-\d\d \d\d:\d\d)\s+(.+)$') | ||
|
||
class FileInfo(object): | ||
def __init__(self, perms, user, group, size, timestamp, name): | ||
|
@@ -62,10 +62,19 @@ def __repr__(self): | |
self.name))) + ')' | ||
|
||
def ListAndroidDir(dir): | ||
dirs = [] | ||
for line in subprocess.check_output(['adb', 'shell', 'ls', '-la', dir]).split('\r\n'): | ||
if line: | ||
m = LS_LINE_REGEX.match(line) | ||
yield FileInfo(*m.groups()) | ||
if m.group(0).startswith('d'): | ||
dirs.append(m.group(6)) | ||
else: | ||
m = LS_LINE_REGEX.match(line) | ||
This comment has been minimized.
Sorry, something went wrong. |
||
yield FileInfo(*m.groups()) | ||
for subdir in dirs: | ||
for value in ListAndroidDir(dir + subdir + '/'): | ||
This comment has been minimized.
Sorry, something went wrong.
xenomachina
|
||
value.name = subdir + '/' + value.name | ||
yield value | ||
|
||
def main(): | ||
parser = argparse.ArgumentParser(description='Android file sync tool.') | ||
|
1 comment
on commit d5ee845
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making this enhancement, and sorry for taking a while getting back to you.
Isn't this line redundant? m was assigned the same value just before the "if".