if xmldir = $xmldoc.elements["//dir[@path='#{utf8(dir)}']"]
xmldir.elements.each { |element|
if %w(image video).include?(element.name) && !element.attributes['deleted']
- old_name = old_dest_dir + '/' + make_dest_filename_old(from_utf8(element.attributes['filename'])).sub(/\.[^\.]+$/, '')
+ old_name = new_dest_dir + '/' + make_dest_filename_old(from_utf8(element.attributes['filename'])).sub(/\.[^\.]+$/, '')
new_name = new_dest_dir + '/' + make_dest_filename(from_utf8(element.attributes['filename'])).sub(/\.[^\.]+$/, '')
Dir[old_name + '*'].each { |file|
new_file = file.sub(/^#{Regexp.quote(old_name)}/, new_name)
file != new_file and sys("mv '#{file}' '#{new_file}'")
}
end
+ if element.name == 'dir' && !element.attributes['deleted']
+ old_name = new_dest_dir + '/thumbnails-' + make_dest_filename_old(from_utf8(File.basename(element.attributes['path']))) + '.jpg'
+ new_name = new_dest_dir + '/thumbnails-' + make_dest_filename(from_utf8(File.basename(element.attributes['path']))) + '.jpg'
+ old_name != new_name and sys("mv '#{old_name}' '#{new_name}'")
+ end
}
else
msg 1, "could not find <dir> element by path '#{utf8(dir)}' in xml file"