'Creating a directory called 'con'
In the Ruby console, whenever I try to make a folder 'con', I get the following error:
> FileUtils.mkdir_p('con/')
Errno::ENOTDIR: Not a directory - con
from C:/RailsInstaller/Ruby2.0.0/lib/ruby/2.0.0/fileutils.rb:245:in `mkdir'
from C:/RailsInstaller/Ruby2.0.0/lib/ruby/2.0.0/fileutils.rb:245:in `fu_mkdir'
from C:/RailsInstaller/Ruby2.0.0/lib/ruby/2.0.0/fileutils.rb:219:in `block (2 levels) in mkdir_p'
from C:/RailsInstaller/Ruby2.0.0/lib/ruby/2.0.0/fileutils.rb:217:in `reverse_each'
from C:/RailsInstaller/Ruby2.0.0/lib/ruby/2.0.0/fileutils.rb:217:in `block in mkdir_p'
from C:/RailsInstaller/Ruby2.0.0/lib/ruby/2.0.0/fileutils.rb:203:in `each'
from C:/RailsInstaller/Ruby2.0.0/lib/ruby/2.0.0/fileutils.rb:203:in `mkdir_p'
from (irb):21
from C:/RailsInstaller/Ruby2.0.0/bin/irb:12:in `<top (required)>'
from -e:1:in `load'
from -e:1:in `<main>'
It does not happen for other names.
Why does this happen?
I use Ruby 2.0.0.
Solution 1:[1]
It seems like you're using Windows.
In Windows, con
is a reserved name for device (console
). You cannot use that as a direcotry/file name.
See MS-DOS Device Driver Names Cannot be Used as File Names.
Solution 2:[2]
The folder con
is an system-folder, you can't create this folder, delete this folder or save files in it, or read files from it,because con
is a simulated device for the cmd. In the Safe Mode
you can create this folder. Ther are some other folder-names like con
.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | falsetru |
Solution 2 | aWebDesigner123 |