The canonical answer would be: use tar to create the archive with relative paths and the user directory as top level directory, then extract it in /users/<user>. Nothing special there, as creating relative paths is default.
In Perl, you could use Archive::Tar. Basically, create the archive whichever way you want, using add_files and write (Archive::Tar::write, that is). Then on extraction, use list_files and get_contents to get the various files and write them back wherever you want.
This, however, seems to be a case of hammeritis: 'if you have a big hammer, everything looks like a nail'. Plain command line tar would be the best solution here.
CU Robartes- | [reply] [d/l] [select] |
Thanks for your reply.
I wrote a simple code that using a system command.
| [reply] |
Starting from the top:
Is this going to run on one machine that serves multiple domains? Or is it supposed to telnet to a server, tar everything up and return a tarball? Or are you trying to connect to someone else's website and download their code?
Next, why are you doing this? Are you trying to create a backup? For that, you'd be better off having everyone use cvs and setting up a tape archiving system.
Last, try putting a little thought into it yourself. CPAN and Perlmonks' Code Catacombs are full of code that address these issues. Morover, even if you want to use system calls instead of modules for the tarring and copying, this is a really basic script. Somehow, I get the feeling that this is a homework assignment. Take a stab at writing it yourself, and if you run into a specific problem, I'll be glad to help.
-Logan
"What do I want? I'm an American. I want more." | [reply] |
Thanks for your reply.
I wrote a simple code that using a system command.
Sure i will ask your help..
| [reply] |