I am trying to use a script to change the working directory using Dir.chdir
This works:
dirs = ['//servername/share','//servername2/share']
dirs.each do |dir|
Dir.chdir dir
end
If I put the above share information into a text file (each share on a new line) and try to load:
File.foreach("shares.txt") {|dir|
Dir.chdir dir
}
I get this error:
'chdir': No such file or directory - //servername/share (Errno::ENOENT)
How can I read the shares from a text file and change to that directory? Is there a better way to do this?