Is there any way to create folders in batch? I need to create around 50 but don't fancy doing this manually. -- John
John Poltorak wrote:
Is there any way to create folders in batch?
I need to create around 50 but don't fancy doing this manually.
John, Put this in a python script and test. for n in range(10): container.manage_addFolder(id= str(n)) David
Thanks David, That works fine although it is a little crude. What I'd like to be able to do is create folders with names and titles derived from an external File where each line contains the name and title, separated by a comma. Guess I need to find out how to get python to read lines from a Zope File object.... On Wed, Jun 22, 2005 at 10:49:07AM -0700, David H wrote:
John Poltorak wrote:
Is there any way to create folders in batch?
I need to create around 50 but don't fancy doing this manually.
John,
Put this in a python script and test.
for n in range(10): container.manage_addFolder(id= str(n))
David
John, Seems like external scripts and dictionaries are a theme today. You need to check python manuals for file handling. Its a simple implementation. Then you would parse out names and title and put them in a dictionary and return. then in replace range(1...10) as seen in earlier messages with something *like* for n in yourDictionary: container.manage_addFolder(id = n, title = yourDictionary[n]) David John Poltorak wrote:
Thanks David,
That works fine although it is a little crude. What I'd like to be able to do is create folders with names and titles derived from an external File where each line contains the name and title, separated by a comma.
Guess I need to find out how to get python to read lines from a Zope File object....
On Wed, Jun 22, 2005 at 10:49:07AM -0700, David H wrote:
John Poltorak wrote:
Is there any way to create folders in batch?
I need to create around 50 but don't fancy doing this manually.
John,
Put this in a python script and test.
for n in range(10): container.manage_addFolder(id= str(n))
David
Hi David, I'm used to using the term 'file'. I guess it isn't appropriate in this case since I'm not actually handling a file but a Zope File object. I'm not sure where to look to see how Python handles this... John On Thu, Jun 23, 2005 at 04:30:07PM -0700, David H wrote:
John,
Seems like external scripts and dictionaries are a theme today. You need to check python manuals for file handling. Its a simple implementation. Then you would parse out names and title and put them in a dictionary and return.
then in replace range(1...10) as seen in earlier messages with something *like*
for n in yourDictionary: container.manage_addFolder(id = n, title = yourDictionary[n])
David
John Poltorak wrote:
Thanks David,
That works fine although it is a little crude. What I'd like to be able to do is create folders with names and titles derived from an external File where each line contains the name and title, separated by a comma.
Guess I need to find out how to get python to read lines from a Zope File object....
On Wed, Jun 22, 2005 at 10:49:07AM -0700, David H wrote:
John Poltorak wrote:
Is there any way to create folders in batch?
I need to create around 50 but don't fancy doing this manually.
John,
Put this in a python script and test.
for n in range(10): container.manage_addFolder(id= str(n))
David
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 John Poltorak wrote:
Hi David,
I'm used to using the term 'file'. I guess it isn't appropriate in this case since I'm not actually handling a file but a Zope File object. I'm not sure where to look to see how Python handles this...
File objects allow you to get the data as a Python string via its 'data' attribute. Tres. - -- =================================================================== Tres Seaver +1 202-558-7113 tseaver@palladion.com Palladion Software "Excellence by Design" http://palladion.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.5 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCvBGl+gerLs4ltQ4RAu49AKCTfyhSCth3lDOavdujejpaX+w5vwCffMoM fr5lgTysol92DqtZ671w1hA= =w7TK -----END PGP SIGNATURE-----
participants (3)
-
David H -
John Poltorak -
Tres Seaver