Reputation: 14561
I am trying to copy a file using Julia functions with the hope of manipulating the file and then use that copied version for various tasks in the Julia programming language. Can someone provide some example code of copying a file in Julia?
I guess I could do use read
then write
but it seems like I would be reinventing the wheel.
Is there a standard library function for this?
Inspired by this question.
Upvotes: 10
Views: 3322
Reputation: 10147
Just use the built in function cp(src, dst)
.
Copy the file, link, or directory from
src
todst
.force=true
will first remove an existingdst
.
Afterwards you can open
the file and manipulate it. Of course you could also open both source an destination files simultaneously and copy and manipulate it line by line.
Upvotes: 15