quik77
1
Hi,
I have all of the program “atk” in one directory.
I want to recursively copy this to /usr.
This commandline works in bash shell:
cp -r /Programs/Atk/Current/* /usr/
These examples in Ruby do not work:
FileUtils.cp_r ‘/Programs/ATK/Current/’, ‘/usr’
FileUtils.cp_r ‘/Programs/ATK/Current/’, ‘/usr/’
FileUtils.cp_r ‘/Programs/ATK/Current’, ‘/usr/’
(They all copy Current/ instead of what is inside Current/* )
And using ‘*’ like so
FileUtils.cp_r ‘/Programs/ATK/Current/*’, ‘/usr/’
does neither work.
Does anyone have an idea how to grab the * content
under Current/ and copy that to /usr ?
quik77
2
I was able to solve it with a 4 year old post of Nobu 
One has to add the ‘/.’
I think the docu could mention this:
FileUtils.cp_r( ‘/Programs/ATK/Current/’+"/.", ‘/usr/’)
Works.
quik77
3
Marc H. [email protected] wrote:
I was able to solve it with a 4 year old post of Nobu 
One has to add the ‘/.’
I think the docu could mention this:
The docs do say exactly that, I think:
If you want to copy all contents of a directory instead of the
directory itself, c.f. src/x → dest/x, src/y → dest/y,
use following code.
FileUtils.cp_r ‘src/.’, ‘dest’
m.
quik77
4
On Jul 18, 2008, at 13:40 , Marc H. wrote:
I think the docu could mention this:
FileUtils.cp_r( ‘/Programs/ATK/Current/’+"/.", ‘/usr/’)
there is a whole well documented paragraph of code on it (two in fact,
if you count the glob one):