Cheers, thanks a lot for that. I'll give it a go. I still may be interested in sponsoring a version with the improvements you mention etc and possibly more. Would that code be compatible for Unix and also for Windows NTFS?
<br><br>Thanks<br><br><div><span class="gmail_quote">On 6/22/06, <b class="gmail_sendername">Tino Wildenhain</b> &lt;<a href="mailto:tino@wildenhain.de">tino@wildenhain.de</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
michael nt milne schrieb:<br>&gt; Hi<br>&gt;<br>&gt; Just wondering if anyone has written or attempted to write a script<br>&gt; which would read through a site built using Zope and write all<br>&gt; attached/uploaded files (Word, PDF, Excel) etc to a filesystem location
<br>&gt; in an un-pickled format. Therefore the files would be usable by their<br>&gt; native application and be accessible outside of Zope. The business logic<br>&gt; behind this is to be able to create, say once a day at night, a copy of
<br>&gt; all digital business assets for extra back-up and recovery purposes in<br>&gt; case of disaster. Also this would be good for migration purposes if<br>&gt; required.<br>&gt;<br>&gt; If not, how long would it take to create such a script? I could probably
<br>&gt; source a sponsor for it. I realise that it's best to do this at the<br>&gt; application level and at the moment this would be through Plone.<br>&gt;<br>&gt; I've demoed all the Plone external storage products and also checked out
<br>&gt; DirectoryStorage but all these store pickled files etc.<br><br>----------- snip ----------<br>import os<br>import sys<br><br>try:<br>&nbsp;&nbsp;&nbsp;&nbsp; targetdir=sys.argv[1]<br>except IndexError:<br>&nbsp;&nbsp;&nbsp;&nbsp; print &quot;usage: zopectl run %s &lt;target dirrectory&gt;&quot; % 
sys.argv[0]<br><br>def filedump(resulttuple,basedir):<br>&nbsp;&nbsp;&nbsp;&nbsp; pathname,fileobject=resulttuple<br>&nbsp;&nbsp;&nbsp;&nbsp; print &quot;dumping %s (%d Bytes)&quot; % (fileobject.getId(),fileobject.size)<br>&nbsp;&nbsp;&nbsp;&nbsp; o=open(os.path.join(basedir,pathname.replace
('/','_')+fileobject.getId()),&quot;wb&quot;)<br>&nbsp;&nbsp;&nbsp;&nbsp; o.write(str(fileobject.data))<br><br><br>for res in app.ZopeFind(app,obj_metatypes=['File'])<br>&nbsp;&nbsp;&nbsp;&nbsp; filedump(res,targetdir)<br><br><br>--------- snip -----------<br><br>
and run this over ZEO via zopectl run thescript.py somewhere/to/targetdir<br><br><br>There are possibly many improvements (creating subdirectories, fixing extensions<br>and so on)<br><br>Regards<br>Tino Wildenhain<br><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>michael