# FILEUTILS cp/cp\_r rm/rm\_r on Windows XP

**URL:** <https://www.ruby-forum.com/t/fileutils-cp-cp-r-rm-rm-r-on-windows-xp/133375>\
**Category:** Ruby\
**Created:** [March 31, 2008, 1:17am UTC](https://www.ruby-forum.com/t/fileutils-cp-cp-r-rm-rm-r-on-windows-xp/133375 "2008-03-31T01:17:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![byrnejb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d2c977/32.png) [@byrnejb](https://www.ruby-forum.com/u/byrnejb)\
**Post date:** [March 31, 2008, 1:17am UTC](https://www.ruby-forum.com/t/fileutils-cp-cp-r-rm-rm-r-on-windows-xp/133375/1 "2008-03-31T01:17:58Z")

</div>

I cannot seem to get these commands to work as expected in Windows XP  
pro SP2.

Given this

task :update do  
FileUtils.cp\_r File.join(File.dirname( **FILE** ), ‘views/xyz/’),  
File.join(File.dirname( **FILE** ), ‘…/…/…/app/views’)  
end

I get this:

unknown file type: C:/path/to/source/views/xyz/

Given this:

task :remove do  
FileUtils.rm\_rf File.join(File.dirname( **FILE** ),  
‘…/…/…/app/views/xyz’) rescue nil  
end

I get no errors, but the directory is not removed either. Can someone  
point out my error?

Regards,

---

<div class="post-metadata">

**Author:** ![byrnejb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d2c977/32.png) [@byrnejb](https://www.ruby-forum.com/u/byrnejb)\
**Post date:** [March 31, 2008, 2:27am UTC](https://www.ruby-forum.com/t/fileutils-cp-cp-r-rm-rm-r-on-windows-xp/133375/2 "2008-03-31T02:27:11Z")

</div>

James B. wrote:

> I cannot seem to get these commands to work as expected in Windows XP  
> pro SP2.

I discovered my error by running these with :verbose =\> true. As agent  
86 would say: “Missed me by that much.”

I needed an extra set of ‘…/’ to reach the actual target directories.

---

<div class="post-metadata">

**Author:** ![byrnejb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d2c977/32.png) [@byrnejb](https://www.ruby-forum.com/u/byrnejb)\
**Post date:** [March 31, 2008, 4:15am UTC](https://www.ruby-forum.com/t/fileutils-cp-cp-r-rm-rm-r-on-windows-xp/133375/3 "2008-03-31T04:15:37Z")

</div>

On Mar 30, 9:27 pm, James B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> James B. wrote:
> 
> > I cannot seem to get these commands to work as expected in Windows XP  
> > pro SP2.
> 
> I discovered my error by running these with :verbose =\> true. As agent  
> 86 would say: “Missed me by that much.”
> 
> I needed an extra set of ‘…/’ to reach the actual target directories.

I’ll suggest you use RAILS\_ROOT and join to it instead of guessing  
based on the location of your rakefile 😉

File.join(RAILS\_ROOT, ‘app/views’)

HTH,
