From: Reid Thompson Date: 2008-12-12T12:47:03+09:00 Subject: Re: rename to txt file - file not found in list,but in directory Mmcolli00 Mom wrote: > I am trying to rename a file in my directory. I can see this file in > directory. It has an extention of .dep, when I attempt to rename it, > nothing gets renamed. When I output all filenames from the directory > this particular file containing .dep is not on the list. I can see it is > there, however this script doesn't pull it. Do you know what this might > mean? > > require 'fileutils' > require 'find' > require 'ftools' > require 'enumerator' > > #locate new .dep file and rename to txt file for later modification > > Dir.entries("C:/Diff").each do |filename| > if File.extname("*.dep") then > puts filename > puts File.ftype("2227_12112008090607519.dep") #<--can't find this > File.rename(".dep", "orgDep.txt") #<--doesn't find any file with > .dep > end > end > end require 'fileutils' require 'find' require 'ftools' require 'enumerator' #locate new .dep file and rename to txt file for later modification Dir.entries("/tmp").each do |filename| if File.extname(filename).match(".dep") then puts "#{filename}" puts File.ftype("2227_12112008090607519.dep") #<--can't find this File.rename(filename, "orgDep.txt") #<--doesn't find any file with .dep end end