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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Create New...

Important Information

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