Windows Move/Dir with wildcards?

Hello,
I'm trying to get this to work on WinXP/Win2003 :

x = "./xmloutput/cancellations/*"
`dir #{x} `

`move #{x} "./otherdir" `

So far, the dir gives me "File not found".

Thanks for your advice!

Peter Fitzgibbons

x = "./xmloutput/cacellations/"
files = Dir.glob("#{x}*").entries

`dir #{x}`
files.each{|file|
  `move #{file} ./otherdir`
  }

this is how i would do it... haven't tried it, and i haven't got a win-box to
try it, but it should work...

so long...
manveru

···

Am Dienstag 25 Oktober 2005 18:24 schrieb Peter Fitzgibbons:

Hello,
I'm trying to get this to work on WinXP/Win2003 :

x = "./xmloutput/cancellations/*"
`dir #{x} `

`move #{x} "./otherdir" `

So far, the dir gives me "File not found".

Thanks for your advice!

Peter Fitzgibbons

You're passing Ruby style filenames (i.e. with "/") to the DOS command
shell (which expects "\").

A pure Ruby solution would be:

require 'fileutils'
FileUtils.move Dir["./xmloutput/cancellations/*"], "./otherdir"

Regards,

Sean

···

On 10/25/05, Peter Fitzgibbons <peter.fitzgibbons@gmail.com> wrote:

Hello,
I'm trying to get this to work on WinXP/Win2003 :

x = "./xmloutput/cancellations/*"
`dir #{x} `

`move #{x} "./otherdir" `