# Cp loops



## kolbycrouch (Jan 18, 2010)

for some reason, freebsd-8 netbsd-current and even on linux i believe.
the cp command loops when doing this
`cp -Rvp /home/user/path/.* /home/user/path/`

I do this to copy all my dotfiles.
example of what i mean by loop
`cp /media/hdd/.zshrc > /home/user/.zshrc`
`cp /media/hdd/../hdd/.zshrc > /home/user/hdd/.zshrc`

and it continues forever?
I'm sorry if this isn't clear.


----------



## crsd (Jan 18, 2010)

Try using [cmd=""]cp -Rvp /home/user/path/.[^.]* /home/user/path[/cmd] to exclude *..* from the glob.


----------



## SirDice (Jan 18, 2010)

.* also includes ..


----------



## sixtydoses (Jan 19, 2010)

`cp -Rvp /home/user/path/[^.]* /home/user/path/`


----------



## crsd (Jan 19, 2010)

sixtydoses said:
			
		

> `cp -Rvp /home/user/path/[^.]* /home/user/path/`



grep dotfiles original_post


----------



## sixtydoses (Jan 19, 2010)

Oh yea.. my bad. Thanks


----------

