Forum Archive

Transfer folder from iphone to ipad

dnino99

I have Pythonista v2 on my iPhone and v3 on my iPad. I can move individual Pythonista files from my iphone to my iPad using Airdrop. Is there a way to move a entire Pythonista folder from my iphone to iPad? Folder has .py, .jpg, .mov, .txt and .html files.

cvp

@dnino99 If on your iPhone you upgrade to Pythonista 3, you could transmit via iCloud Drive

cvp

@dnino99 or you zip your folder on your iPhone, airdrop the .zip to your iPad and unzip there

# coding: utf-8
import os
import zipfile
def main():
    folder = "xxxxxxx"
    doc_path = os.path.expanduser("~/Documents/"+folder)
    os.chdir(doc_path)
    backup_file = os.path.expanduser("~/Documents/folder.zip")
    zip = zipfile.ZipFile(backup_file,mode='w')
    for dir_or_file in os.listdir(doc_path):
        zip.write(dir_or_file)
    zip.close()         
# Protect against import    
if __name__ == '__main__':
    main()
dnino99

@cvp Thank you so much for reply. I have tediously copied each file to iPad via Airdrop. I will use your zip file script the next time I need to move folder contents to my iPad. I use Pythonista every day. It is by far the most complete and polished Python - HTML development tool ever.

cvp

@dnino99 If you have Pythonista 3 on one iDevice and if you have the same Apple account on the other, it is free to upgrade.

dnino99

@cvp Thank you so much, I have now downloaded version 3 to my iPhone for free. My next project will be to convert my version 2 scripts to run on version 3. Aloha.

themusicman

You can also use iCloud to share / move your Pythonista files between your iPhone, iPad and Mac. 👍

ccc

@cvp Can you please edit your code above to add a carriage return before the trailing three backticks? Putting them alone on the next line will makes them disappear which will make you code easier to copy and paste. Thx

cvp

@ccc Done, thanks and sorry, I always try to not forget it, but, my memory is often overloaded 😢