Delete any file beginning with some character


#1

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”)


#2

On Tue, Mar 17, 2009 at 2:38 PM, Sarika P.
removed_email_address@domain.invalid 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


#3

Hi,

2009/3/17 Sarika P. removed_email_address@domain.invalid:

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.