Forum OpenACS Development: Re: from File System to Content Repository

Collapse
Posted by Nathan Lunt on
content::folder::new and content::item::new are all you need. You need a recursive procedure that reads a directory tree, then you do this:

1) Add root folder using content::folder::new using the file-storage root folder and package id if you want the files to go to a file-storage instance.

2) Get all the child folders and files under that folder and add each item with content::folder::new or content::item::new as required, again specifying the correct root folder and package id.

3) If you come across a folder, go to step 2 on that folder.

4) Repeat this process until all folders and files are added (no more child folders or files exist).

That's an over-simplification perhaps, but that's the basic idea.

API Docs you need:
content::item::new

content::folder::new