how to pull images from android device from usb in python code example

Example: how to pull images from android device from usb in python

import os
import shutil

#path
path = "'Deze pc'/'HUAWEI Mate 10 lite'/'Interne opslag'"

# List files and directories
# in '/home/User/Documents'
print("Before copying file:")
print(os.listdir(path))

#Source path
source = "C:/Users/Tim/PycharmProjects/project1/testfile.jpg"

# Print file permission
# of the source
perm = os.stat(source).st_mode
print("File Permission mode:", perm, "\n")

# Destination path
destination = "'Deze pc'/'HUAWEI Mate 10 lite'/'Interne opslag'/photos"

# Copy the content of
# source to destination
dest = shutil.copy(source, destination)

# List files and directories
# in "/home / User / Documents"
print("After copying file:")
print(os.listdir(path))

# Print file permission
# of the destination
perm = os.stat(destination).st_mode
print("File Permission mode:", perm)

# Print path of newly
# created file
print("Destination path:", dest)

Tags:

Misc Example