You Are Here:

Community: Developer Discussion Boards

#1 Old shutil.copytree - 2008-10-30, 20:57

Join Date: Mar 2008
Posts: 3
Quintasan
Offline
Registered User
Hi!
I'm currently making a simple python script for backuping the N-Gage 2.0 files, I've tried using the shutil.copytree but the shutil.py in PyS60 doesn't contain any declarations for it.
I want to copy ALL directories and files form C:\Private\20007b39 to E:\ngage_backup
How can I solve my problem?
Reply With Quote

#2 Old Re: shutil.copytree - 2008-10-30, 21:36

Join Date: Feb 2008
Posts: 743
Location: Belo Horizonte, Brazil
Send a message via Skype™ to Rafael T.
Rafael T.'s Avatar
Rafael T.
Offline
Forum Nokia Champion
Quote:
Originally Posted by Quintasan View Post
Hi!
I'm currently making a simple python script for backuping the N-Gage 2.0 files, I've tried using the shutil.copytree but the shutil.py in PyS60 doesn't contain any declarations for it.
I want to copy ALL directories and files form C:\Private\20007b39 to E:\ngage_backup
How can I solve my problem?
Hi Quintasan,

You can use e32 module for copying files.

From Python Reference Library:

Quote:
file copy(target name, source name )

Copies the file source name to target name . The names must be complete paths.
For example:

Code:
import e32

source = 'E:\\Example.sisx'
target = 'E:\\MyFolder'

e32.file_copy(target, source)
Easy?

Although, with e32 module you can't get all the files from a folder, so you will have to list them all

By the way, I don't think we have access to Private folders using PyS60.


EDIT: Post number 200


Hope it helps,

Rafael.
Reply With Quote

#3 Old Re: shutil.copytree - 2008-10-30, 22:38

Join Date: Mar 2008
Posts: 3
Quintasan
Offline
Registered User
Thanks,
If it's like this, I will use the e32 module
I would like to know how to list the files (-_-"), I couldnt find anything in the API refrence
Reply With Quote

#4 Old Re: shutil.copytree - 2008-10-30, 22:49

Join Date: Feb 2008
Posts: 743
Location: Belo Horizonte, Brazil
Send a message via Skype™ to Rafael T.
Rafael T.'s Avatar
Rafael T.
Offline
Forum Nokia Champion
Quote:
Originally Posted by Quintasan View Post
Thanks,
If it's like this, I will use the e32 module
I would like to know how to list the files (-_-"), I couldnt find anything in the API refrence
Well, you could do something like this:

Code:
import e32

source = ['E:\\Example.sisx', 'E:\\Example2.sisx', 'E:\\Example3.sisx']
target = 'E:\\MyFolder'

e32.file_copy(target, source[0])
e32.file_copy(target, source[1])
e32.file_copy(target, source[2])
Using this, you would access the items from the list 'source' by using source[0] (first item), source[1] (second item), source[2] (third item) etc.


Hope it helps,

Rafael.
Last edited by Rafael T. : 2008-10-30 at 23:24.
Reply With Quote

#5 Old Re: shutil.copytree - 2008-10-31, 05:26

Join Date: Oct 2007
Posts: 2,841
Location: Deva, Romania
bogdan.galiceanu's Avatar
bogdan.galiceanu
Offline
Forum Nokia Champion
Quote:
Originally Posted by Rafael T. View Post
Well, you could do something like this:

Code:
import e32

source = ['E:\\Example.sisx', 'E:\\Example2.sisx', 'E:\\Example3.sisx']
target = 'E:\\MyFolder'

e32.file_copy(target, source[0])
e32.file_copy(target, source[1])
e32.file_copy(target, source[2])
Using this, you would access the items from the list 'source' by using source[0] (first item), source[1] (second item), source[2] (third item) etc.


Hope it helps,

Rafael.
I think he meant listing the files in the Private directory. That may be a problem due to the fact that Private is restricted. Generally you could use os.listdir(path) but it might not work here.
Last edited by bogdan.galiceanu : 2008-10-31 at 05:54. Reason: Typo
Reply With Quote

#6 Old Re: shutil.copytree - 2008-10-31, 15:37

Join Date: Feb 2008
Posts: 743
Location: Belo Horizonte, Brazil
Send a message via Skype™ to Rafael T.
Rafael T.'s Avatar
Rafael T.
Offline
Forum Nokia Champion
Quote:
Originally Posted by bogdan.galiceanu View Post
I think he meant listing the files in the Private directory. That may be a problem due to the fact that Private is restricted. Generally you could use os.listdir(path) but it might not work here.
Hi Bogdan,

Yes, on the previous post (the one before the code) I told him:

Quote:
By the way, I don't think we have access to Private folders using PyS60.
Although, he asked how to list after reading this, so I think he wants an example.


BR,

Rafael.
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules

You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia