I am using rsync –list-only command with Django/Python:
subprocess.Popen(['rsync', '--list-only', source],
stdout=subprocess.PIPE,
env={'RSYNC_PASSWORD': password}).communicate()[0]
It returned result like this:
drwxrwxrwx 4096 2012/11/07 09:56:23 upload
I don’t want all the files information. I only want file name displayed like this:
upload
How can I do that? Thanks
rsync has no option to abbreviate the output, you need to use a regex (or
split())Alternatively (as long as file names have no spaces)…