December 31, 200817 yr 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. Thanks. 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.
Create an account or sign in to comment