• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

File compression and copy scrip

dawks

Diamond Member
I am working with Server 2003 R2 SP2. I need to automatically compress and copy files from the server to a NAS drive. I have been playing with cygwin for a bit. My intention is to create a .bat file with a few commands to do this. Sound possible?


Next, can anyone help with the command a little? Im struggling to get it to work (*nix newbie).

Looking at something like tar with gzip and some command to copy (not sure which command to use for this). A *nix buddy said it might be possible to do with one command line? Also is there any way to ensure the fastest transfer possible? Just using Windows Explorer to copy is only giving me 3% utilization of gigabit.. Just wondering if theres a faster way than smb.

Also would it be a better idea to compress the file locally and then copy it? or just compress and write to the network drive on the fly?


Thanks!
 
7Zip + Robocopy.

7Zip command line lets you compress stuff. Robocopy will copy it over. And yes, I'd do it as 2 step operation.
 
If you want the files compressed on the target as well and aren't just trying to compress them in transit to save bandwidth you could write a script to loop over all of the files (this'll be the complicated part, especially if you want to preserve the current directory structure) and then compress/copy each file to the destination. For example, gzip can write to stdout so you can 'gzip blah -c > blah.gz' to compress the file blah to blah.gz without modifying the first at all.
 
I'm going to play the Devil's Advocate here. Why do you need Cygwin to do this? If you are on a Windows platform, you should use VBscript which can do this on the platform with no third party tools (granted the syntax in the script will be a little more complex). What you're doing is just creating dependencies, which will cause headaches when you need to move or deploy this script somewhere else. The same thing happens when you use 7Zip & Robocopy.
 
Back
Top