I cannot believe I’m having trouble with this - it should be utterly
trivial, but I just can’t get Ruby to work correctly on this.
I’ve got a directory with subdirectories that have names such as
“Eb97503.120822”, where 97503 is a job submission number, and 120822 is
a time-date stamp. So the directory contents might look like this:
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:
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.