From: Eliezer Croitoru Date: 2012-08-24T10:33:44+09:00 Subject: Re: deleting directories matching a pattern On 8/24/2012 2:10 AM, Thomas Luedeke wrote: > Eb97503.120622 > Eb97504.120622 > Eb98537.120722 > Eb99659.120822 > > I want to pattern match the job submission number, and delete the > directories. I must have tried ten different ways of doing it using > strings set with the job submission number, but I just can't get it to > work. > > How the heck do I delete the middle two directories, once I have strings > set as: > > job1 = 97504 > job2 = 98537 > > This is embarrassing.... it's pretty strait forward.. loop all over the directories to match any of the jobs. it's better you will use some array\hash and then read each directory name. then iterate over then and match them. if the Eb is static prefix you can use the next psudo: match the current directory name to the job number hint: "dir_name".start_with? ("Eb" + job + ".") and in a match case erase the directory and erase the job from the todo list. an exit mark can be then end of the directories list with a log of unfind jobs that was needed to be erased or.. the jobs to erase size is 0. Good luck, Eliezer -- Eliezer Croitoru https://www1.ngtech.co.il IT consulting for Nonprofit organizations eliezer ngtech.co.il