Posted on 06-07-2017 02:54 PM
Hi All,
Been poking around a bit but haven't found a ton of info on this. Basically, our current process when a user departs is to archive their entire home folder on a server for a period of time. It's an old SMB server so the performance when copying individual files over is pretty horrible, as such I wanna compress the file to a .zip archive, then move that to the share. I've got it all working just fantastic, and am using the "zip" command in terminal. BUT, it really chokes on the Library > Containers folder with all of the aliases. It seems to compress each alias instance with the full original file size - so instead of decreasing the size, my 22GB test user folder became a 40GB zip archive... Anybody have any advice on flags or gzip or some other method that may handle the aliases better?
here's my specific command for reference:
#!/bin/sh
zip -r /$username.zip /Users/$username
Posted on 06-07-2017 03:53 PM
Try adding the 'y' flag
#!/bin/sh
zip -ry /$username.zip /Users/$username
From man page
-y --symlinks For UNIX and VMS (V8.3 and later), store symbolic links as such in the zip archive, instead of compressing and storing the file referred to by the link. This can avoid multiple copies of files being included in the archive as zip recurses the direc- tory trees and accesses files directly and by links
Posted on 06-07-2017 05:52 PM
You could also tar it to the SMB share if its mounted:
tar -cvzf /Users/$username.tgz /path/to/SMBmount
Posted on 06-08-2017 07:28 AM
thank you! Gonna give both of these a try and see how the go.
Appreciate it!
Posted on 06-08-2017 08:52 AM
tar does the trick. Even with the y flag zip still is more than double the size.
Thanks everyone!