# Permission denied when running file

**URL:** <https://www.ruby-forum.com/t/permission-denied-when-running-file/162786>\
**Category:** Ruby\
**Created:** [March 13, 2009, 7:35pm UTC](https://www.ruby-forum.com/t/permission-denied-when-running-file/162786 "2009-03-13T19:35:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bwinborg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/51bf81/32.png) [@bwinborg](https://www.ruby-forum.com/u/bwinborg)\
**Post date:** [March 13, 2009, 7:35pm UTC](https://www.ruby-forum.com/t/permission-denied-when-running-file/162786/1 "2009-03-13T19:35:19Z")

</div>

I am having a problem that I can’t seem to track down the attached file  
worked fine a week ago, to my knowledge nothing has changed. However now  
when I try to run it I get Permission denied this happens on other files  
also. I have pasted the command prompt screen, the path and PATHEXT.  
Anybody have any ideas?

Microsoft Windows XP [Version 5.1.2600]  
© Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\Brad\>cd c:\ruby

C:\Ruby\>ruby -v  
ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-mswin32]

C:\Ruby\>ruby WarningErrorCount.rb  
WarningErrorCount.rb:15:in `initialize': Permission denied - C:\Ruby\bin (Errno: :EACCES) from WarningErrorCount.rb:15:in`open’  
from WarningErrorCount.rb:15  
from WarningErrorCount.rb:12:in `each’  
from WarningErrorCount.rb:12

C:\Ruby\>ruby.exe WarningErrorCount.rb  
WarningErrorCount.rb:15:in `initialize': Permission denied - C:\Ruby\bin (Errno: :EACCES) from WarningErrorCount.rb:15:in`open’  
from WarningErrorCount.rb:15  
from WarningErrorCount.rb:12:in `each’  
from WarningErrorCount.rb:12

C:\Ruby\>

Path = C:\Program Files\Liquid Technologies\Liquid XML Studio  
2009\XmlDataBinder7\Redist7\cpp\win32\bin;C:\Program  
Files\QuickTime\QTSystem;C:\Program Files\Common Files\Roxio  
Shared\DLLShared;C:\Program Files\Microsoft SQL  
Server\80\Tools\Binn;C:\Program Files\Microsoft SQL  
Server\90\Tools\binn;C:\Program Files\Microsoft SQL  
Server\90\DTS\Binn;C:\Program Files\Microsoft SQL  
Server\90\Tools\Binn\VSShell\Common7\IDE;C:\Program Files\Microsoft  
Visual Studio 8\Common7\IDE\PrivateAssemblies;C:\Program  
Files\Microsoft SQL Server\100\Tools\Binn;C:\Program Files\Microsoft  
SQL Server\100\DTS\Binn;C:\Program Files\Microsoft SQL  
Server\100\Tools\Binn\VSShell\Common7\IDE;C:\Program Files\Microsoft  
Visual Studio  
9.0\Common7\IDE\PrivateAssemblies;C:\WINDOWS\system32\WindowsPowerShell\v1.0;C:\Program  
Files\VMware\Infrastructure\VIToolkitForWindows\Scripts;C:\Program  
Files\Pinnacle\Studio 11;C:\Program Files\Pinnacle\Studio  
11\Plugins;C:\Program Files\MySQL\MySQL Server 5.0\bin;C:\Ruby\bin

PATHEXT =  
COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.py;.pyw;.tcl;.RB;.RBW

---

<div class="post-metadata">

**Author:** ![bwinborg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/51bf81/32.png) [@bwinborg](https://www.ruby-forum.com/u/bwinborg)\
**Post date:** [March 13, 2009, 11:44pm UTC](https://www.ruby-forum.com/t/permission-denied-when-running-file/162786/2 "2009-03-13T23:44:30Z")

</div>

Hi,

2009/3/14 Brad W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> C:\Documents and Settings\Brad\>cd c:\ruby  
> Â Â Â Â from WarningErrorCount.rb:12:in `each’

The error message means File.open(‘C:\Ruby\bin’,‘r’) failed.

To skip directory, modify line #13  
unless fl == ‘.’ or fl == ‘…’ then  
to  
unless File.directory?(my\_path + fl) then

Regards,

Park H.
