K
Kyle Hunter
Hello,
I've got an array that holds urls. Example Element:
http://bla.random.com/bla.jpg.
I also have images in a directory. I'd like my script to compare the
bla.jpg from the URL with all files in a directory to make sure it's not
a duplicate of something that's already there - if it is - delete it
from the array. My current way of doing it uses quite a bit of
resources, was wondering if someone could show me a more efficient
example if possible.
Current Code:
Dir["#{$baseDir}/#{board}/#{$dateString}/**"].each do |file|
$imgArray.delete_if{
|i| i =~ /#{file.split('/').pop}/
}
I've got an array that holds urls. Example Element:
http://bla.random.com/bla.jpg.
I also have images in a directory. I'd like my script to compare the
bla.jpg from the URL with all files in a directory to make sure it's not
a duplicate of something that's already there - if it is - delete it
from the array. My current way of doing it uses quite a bit of
resources, was wondering if someone could show me a more efficient
example if possible.
Current Code:
Dir["#{$baseDir}/#{board}/#{$dateString}/**"].each do |file|
$imgArray.delete_if{
|i| i =~ /#{file.split('/').pop}/
}