From 811a93986d1a051c550f2ec39f83c714ee7738ff Mon Sep 17 00:00:00 2001 From: Colin Patrick McCabe Date: Wed, 8 Feb 2012 20:20:19 -0800 Subject: [PATCH] names_to_numbers.rb: fix rename same-to-same Don't give an error when the source and destination file names happen to be the same in our rename operation. (This would occur if some of the files were already named as we desire.) Signed-off-by: Colin McCabe --- names_to_numbers.rb | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/names_to_numbers.rb b/names_to_numbers.rb index 9439fd1..0fac484 100755 --- a/names_to_numbers.rb +++ b/names_to_numbers.rb @@ -76,8 +76,10 @@ def get_file_name(num) end def rename_files(file) - FileUtils.mv(file, "#{get_file_name(1 + $total_files)}.#{$opts.extension}", - $fu_args) + dst="#{get_file_name(1 + $total_files)}.#{$opts.extension}" + if (file != dst) then + FileUtils.mv(file, dst, $fu_args) + end $total_files = $total_files + 1 end -- 1.6.6.rc1.39.g9a42