Delete any file beginning with some character

Hi,

I am trying to delete files in a folder whichever beginning with any
string
but not able to do it?
Command used in rb file is

File.delete(“A*.jpg”)

On Tue, Mar 17, 2009 at 2:38 PM, Sarika P.
[email protected] wrote:

Try:
Dir.glob(‘A*.jpg’).each { |file| File.delete(file) }

Andrew T.
http://ramblingsonrails.com
http://www.linkedin.com/in/andrewtimberlake

“I have never let my schooling interfere with my education” - Mark Twain

Hi,

2009/3/17 Sarika P. [email protected]:

Hi,

I am trying to delete files in a folder whichever beginning with any
string
but not able to do it?
Command used in rb file is

File.delete(“A*.jpg”)
require ‘fileutils’
FileUtils.rm Dir.glob(‘A*.jpg’)

Regards,

Park H.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs