Hi Nima,
If you are daring enough to work on this, on the LORS package (https://openacs.org/forums/message-view?message_id=160385) I released, there's a lors::imscp::expand_file that unpacks a .tgz or .zip file into a tmp directory (creating all the subdirs and all) and then there's a bunch of functions that allow you to add files and directories to the content repository:
# lors::cr::add_files (public)
# lors::cr::add_folder (public)
# lors::cr::has_dirs (public)
# lors::cr::has_files (public)
They replicate the exact same copy of the file-system to the CR. There's an example of the use of them on the random package that I use as UI for the LORS package... have a look here:
http://mlweg.pc.ee.usyd.edu.au:8080/files/view/20040309_random.tgz
I hope this helps,
Ernie