# Copy binary files to dir and zip

**URL:** <https://www.ruby-forum.com/t/copy-binary-files-to-dir-and-zip/104064>\
**Category:** Ruby\
**Created:** [May 13, 2007, 9:52pm UTC](https://www.ruby-forum.com/t/copy-binary-files-to-dir-and-zip/104064 "2007-05-13T21:52:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![chasconquest](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/bb73d2/32.png) [@chasconquest](https://www.ruby-forum.com/u/chasconquest)\
**Post date:** [May 13, 2007, 9:52pm UTC](https://www.ruby-forum.com/t/copy-binary-files-to-dir-and-zip/104064/1 "2007-05-13T21:52:54Z")

</div>

‘src’ dir contains 2 binary files (mp3s)

I want to copy the files from ‘src’ into a new dir and then zip it.

The copy into a new dir is fine, but

I can’t seem to get the new dir in to the zip.

Any clues?  
Thanks!

\<----Code-----\>

require ‘rubygems’  
require ‘zip/zipfilesystem’  
require ‘FileUtils’

stuff = FileUtils.cp\_r ‘src/.’, ‘order’ #this copies the files  
fine…

Zip::ZipFile.open(‘stuff.zip’, Zip::ZipFile::CREATE) do |zip|  
zip.file.open(‘stuff.zip’, ‘w’) { |f1| f1 \<\< ‘order’}  
end
