P
Peter Bailey
Hi,
I just want to do a simple case-changing operation, if needed. The file
renaming scheme below works for me, but, if any files in my directory
are already lowercase, then, the script fails. How can I accommodate
files that may or may not be lowercase to begin with and just make them
lowercase, whatever they originally were. It seems to me that the "!" is
what's demanding that my original files here be upper-case, but, I can't
seem to get the thing to work without that "!."
Thanks,
Peter
require 'FileUtils'
Dir.chdir("C:/bitmaps/notif")
Dir.glob("*.pdf").each do |file|
File.rename("#{file}", "#{file.downcase!}")
FileUtils.mv(file, "c:/bitmaps/notif/scratch")
end
...
I just want to do a simple case-changing operation, if needed. The file
renaming scheme below works for me, but, if any files in my directory
are already lowercase, then, the script fails. How can I accommodate
files that may or may not be lowercase to begin with and just make them
lowercase, whatever they originally were. It seems to me that the "!" is
what's demanding that my original files here be upper-case, but, I can't
seem to get the thing to work without that "!."
Thanks,
Peter
require 'FileUtils'
Dir.chdir("C:/bitmaps/notif")
Dir.glob("*.pdf").each do |file|
File.rename("#{file}", "#{file.downcase!}")
FileUtils.mv(file, "c:/bitmaps/notif/scratch")
end
...