Copying files in use with Ruby

329 views Asked by At

I need to copy some files that are in use by windows with a ruby script. The OS will either be Windows XP or Windows 7 both 32-bit. Can anyone point me to some information on using Volume Shadow copy with ruby? Is there a gem for this? I would prefer a solution that does not require administrator privileges but whatever works.

I would also be interested in checking if a file is in use before coping / deleting. Thanks in advance for your help.

1

There are 1 answers

0
maerics On

If there isn't a Ruby library for that purpose you could just use the Windows Volume Shadow Copy API directly via Ruby's WIN32 API (or WIN32 OLE, if available). Here's a useful thread on using Win32API.