[ale] Archiving directories/files with "compressed" mirror version

Chris Woodfield rekoil at semihuman.com
Wed Aug 13 14:31:44 EDT 2008


I'm handling a request that I'd be surprised if no one's run into  
before, so I figured I'd

The request is to be able to walk a directory tree and make a mirrored  
copy of the directory, but with every file compressed. Not make a  
single archive of the dir - the end result will have all directories  
with the same names, perms, etc, but each file will be a bzip'ed  
version of the original.

So, given the following files:

foo/file1.txt
foo/bar/
foo/bar/file2.txt
foo/bar/file3.txt
foo/baz/
foo/baz/file4/txt

The resulting dir will look like:

foo.archive/
foo.archive/file1.txt.bz2
foo.archive/bar/
foo.archive/bar/file2.txt.bz2
foo.archive/bar/file3.txt.bz2
foo.archive/baz/
foo.archive/baz/file4.txt.bz2

Anyone out there have working code to do something like this? Perl  
preferred...

Thanks,

-C


More information about the Ale mailing list