Eric-
Thanks, but could you elaborate? How would you rewrite your line:
File.delete(Dir[""])
to specify deleting all files in the directory “output”.
Thanks!
-Kurt
···
-----Original Message-----
From: Eric Hodel [mailto:drbrain@segment7.net]
Sent: Saturday, December 28, 2002 10:14 PM
To: ruby-talk@ruby-lang.org
Subject: Re: Basic file deleting question…
Kurt Euler (keuler@portal.com) wrote:
All-
What Ruby command will delete all files within a directory. (I’m using Ruby on Windows.)
I’m trying to delete all files within the directory “output”, which is itself in the current directory.
I’ve tried various lines looking like this:
File.delete(“./output/*”)
But I keep getting “Invalid arguement” or “permission denied” errors.
[22:10] drbrain@asx:~/ruby/tmp$ touch one two
[22:10] drbrain@asx:~/ruby/tmp$ ls
one two
[22:10] drbrain@asx:~/ruby/tmp$ ruby -e ‘File.delete(“one”, “two”)’
[22:10] drbrain@asx:~/ruby/tmp$ ls
[22:11] drbrain@asx:~/ruby/tmp$ touch one two
[22:10] drbrain@asx:~/ruby/tmp$ ls
one two
[22:11] drbrain@asx:~/ruby/tmp$ ruby -e ‘File.delete(Dir[""])’
[22:12] drbrain@asx:~/ruby/tmp$ ls
[22:12] drbrain@asx:~/ruby/tmp$
–
Eric Hodel - drbrain@segment7.net - http://segment7.net
All messages signed with fingerprint:
FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04