It does not remove the target file first, but simply writes content on top of it and keeps the remaining contents. Look at the following example on Xubuntu 14.04:
$ more test1.txt
asdasfd
sfasf
asdad
sdsdg gsdg
$ more test2.txt
dfs
sdfs
sdffsdfsgs sdgsgsdgds gsdgs
sdgs sdgsdsdh
$ julia
_
_ _ _(_)_ | A fresh approach to technical computing
(_) | (_) (_) | Documentation: http://docs.julialang.org
_ _ _| |_ __ _ | Type "help()" for help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 0.3.1 (2014-09-21 21:30 UTC)
_/ |\__'_|_|_|\__'_| | Official http://julialang.org release
|__/ | x86_64-linux-gnu
julia> cp("test1.txt", "test2.txt")
File("test2.txt",false,-1)
julia> quit()
$ more test2.txt
asdasfd
sfasf
asdad
sdsdg gsdggsdgs
sdgs sdgsdsdh
It does not remove the target file first, but simply writes content on top of it and keeps the remaining contents. Look at the following example on Xubuntu 14.04:
Edit: ivarne (added quotes)