Jump to content
Sign in to follow this  
Jesse Barnum

Copy directories

Recommended Posts

I was hoping to do something similar to this. Could anyone suggest the best way to copy a whole directory. Instead of moving it I need to copy a directory from one place to another.


This is a little bit more involved - it's not a one-liner, but it's not too difficult. You'll create the new directory with mkdir(), and then you'll copy the files by opening an InputStream for each file, an OutputStream for where you want to copy it do, and then writing a loop that transfers bytes from the InputStream to the OutputStream.

There may be a shortcut to do this in Groovy (I know the Java way of doing it, and Groovy tends to have many more convenience methods than Java) - try googling 'copy file groovy' or something similar.

If you'd like to have us write the script for you, it will probably take 20-30 minutes. Our hourly rate is $155.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  


Important Information

By using this site, you agree to our Terms of Use.