06-01-2009 05:39 AM
06-01-2009 06:15 AM
06-01-2009 06:22 AM
06-02-2009 05:05 AM
06-08-2009 02:38 PM
06-30-2009 03:42 PM
# acpParser.py
# Requires Windows, Python 3.0+, & lxml
from lxml import etree
import os,zipfile,sys
def extractFolderAndContent(source_node):
for node in source_node:
# If the node is a cm:folder node
if (node.tag.find('{http://www.alfresco.org/model/content/1.0}folder') != -1):
# print(node.tag)
FOUND_PROPS = False
for y in node:
if (y.tag.find('{http://www.alfresco.org/view/repository/1.0}properties')):
for x in node[2]:
# Find the folder name node and save the name
if (x.tag.find('name') != -1):
# print('Folder: ',x.text)
folderName = x.text
FOUND_PROPS = True
break
if (FOUND_PROPS == True):
break
# Make the Folder
os.mkdir(folderName)
# print('CD: ', folderName)
# Move into the Folder
os.chdir(folderName)
# print('MID: ',folderName)
# Find the view:associations tag and save it in
for x in node:
if (x.tag.find('{http://www.alfresco.org/view/repository/1.0}associations') != -1):
try:
# print('Recursing with',x[0],sep=' ')
extractFolderAndContent(x[0]) # Pass in the cm:contains node
except:
print('Empty folder')
break
# Move out of the Folder
os.chdir(os.pardir)
elif (node.tag.find('{http://www.alfresco.org/model/content/1.0}content') != -1):
print('FOUND CONTENT NODE ',node.tag)
for y in node:
# print(y.tag)
if y.tag.find('{http://www.alfresco.org/view/repository/1.0}properties') != -1:
for x in y:
if (x.tag.find('{http://www.alfresco.org/model/content/1.0}name') != -1):
print(x.text)
realName = x.text
if (x.tag.find('{http://www.alfresco.org/model/content/1.0}content') != -1):
print(x.text)
alfName = x.text.split('|')[0].split('=')[1]
break
break
alfZipName = alfName.replace('\\','/')
theZip.extract(alfZipName)
# print('EF: ',alfZipName)
os.rename(alfName, realName)
# print('MF:',alfName,'///',realName,sep=' ')
try:
os.rmdir(name)
# print('RD:',name,sep=' ')
except:
print('Tried to delete non-existant folder. Continuing')
zipName = sys.argv[1]
absZip = os.path.abspath('.') + '\\' + zipName
theZip = zipfile.ZipFile(absZip)
name = zipName.split('.')[0]
manifest = name + '.xml'
theZip.extract(manifest)
manifest = os.path.abspath('.') + '\\' + manifest
dom = etree.parse(manifest)
root = dom.getroot()
extractFolderAndContent(root)
os.remove(manifest)
11-17-2010 07:44 AM
Yes - access the repository via CIFS and use your favourite zip program 🙂
Paul.
11-18-2010 02:50 PM
04-04-2011 12:22 AM
There's two approaches. You can either package up your content on the server and then download that bundle in the same way that export via ACP works. Or you can use one of the file system projections to select the files you want and do the packaging on your client.
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.