[Wtr-general] Can an 'excel' file be renamed with a Watir command?
Adam Reed
areed at relocationcentral.com
Wed Jun 6 13:22:16 EDT 2007
You should be able to use:
File.rename("afile", "afile.bak")
This is listed in the Pragmatic Programmer's (free) Guide to Ruby:
http://www.rubycentral.com/book/ref_c_file.html
So you'd just do a little:
if File.exists?("test.xls")
File.rename("test.xls", "old_test.xls")
else...
end...
Thanks,
Adam
-----Original Message-----
From: wtr-general-bounces at rubyforge.org
[mailto:wtr-general-bounces at rubyforge.org] On Behalf Of vijay
Sent: Wednesday, June 06, 2007 12:15 PM
To: wtr-general at rubyforge.org
Subject: [Wtr-general] Can an 'excel' file be renamed with a Watir
command?
Hello people,
I have got a script that creates an 'excel_file' while running. After
running, I want to rename it so that next time, when the script is run,
it will create the excel file anew. Can I do that? I tried a few DOS
commands but I could find only two DOS commands working in Watir. They
are 'Dir.mkdir(directory)' and 'rmdir(directory)'
Thanks, in Advance,
Vijay
_______________________________________________
Wtr-general mailing list
Wtr-general at rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general
More information about the Wtr-general
mailing list