rename to txt file - file not found in list,but in directory

M

Mmcolli00 Mom

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
 
R

Reid Thompson

Mmcolli00 said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,810
Latest member
Kassie0918

Latest Threads

Top