简体   繁体   中英

Python program issue when pointing to folder on cell phone (Samsung Galaxy S5)

I'm working on a Python program to simply pull files from a folder location on my laptop and bring them into a folder location on my cell phone, which is a Samsung Galaxy S5. I had success when testing this out with 2 folders on my desktop, but it can't seem to find the location on my cell phone. Can someone help?

Source Code:

importos
importshutil
importglob
fordatainglob.glob('C:/Users/Shane/Music/Transfer Files/*.mp3'):
    shutil.move(data, 'This PC\Shane (Galaxy S5)\Card\Music')

Error Message:

FileNotFoundError: [Errno 2] No such file or directory: 'This PC\\Shane (Galaxy S5)\\Card\\Music'

Just remove 'This PC' and replace it with partition name to which you want to move data for example 'F:'. And replace '\\' with '/' or two back slashes and also I think there is no need of 'os' module.

importshutil importglob fordatainglob.glob('C:/Users/Shane/Music/Transfer Files/*.mp3'): shutil.move(data, 'F:/Shane (Galaxy S5)/Card/Music')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM