logankilpatrick
logankilpatrick

Reputation: 14561

How do I copy a file in Julia?

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

Answers (1)

carstenbauer
carstenbauer

Reputation: 10147

Just use the built in function cp(src, dst).

Copy the file, link, or directory from src to dst. force=true will first remove an existing dst.

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

Related Questions