See this answer.
You have to place your URLs into a list and iterate over all locations - or just use os.walk()
and
ing strings, you end up with source
having the last value in your expression.You have to place your URLs into a list and iterate over all locations - or just use os.walk()
for loc, _, files in os.walk('mtp://[usb:001,025]/Phone/Pictures'): for file_name in files: if file_name.endswith('jpg'): shutil.copy(os.path.join(loc, file_name), dest)
Test everything in a Python shell (iPython, Azure Notebook, etc.)
- Someone gave you an advice you liked? Test it - maybe the advice was actually bad.
- Someone gave you an advice you think is bad? Test it before arguing - maybe it was good.
- You posted a claim that something you did not test works? Be prepared to eat your hat.