Ada.Directories.Copy_File (Source_Name => Src,
Target_Name => Dst);
File.Copy(src, dst, true);
character, dimension(n_buff) :: buffer
open (newunit=u_r,file="src", action="read", form="unformatted", &
access="stream")
open(newunit=u_w,file="dst", action="write", form="unformatted",&
access="stream")
inquire(unit=u_r,size=sz)
do while (sz > 0)
n_chunk = min(sz, n_buff)
read (unit=u_r) buffer(1:n_chunk)
write (unit=u_w) buffer(1:n_chunk)
sz = sz - n_chunk
end do
func copy(dst, src string) error {
data, err := os.ReadFile(src)
if err != nil {
return err
}
stat, err := os.Stat(src)
if err != nil {
return err
}
err = os.WriteFile(dst, data, stat.Mode())
if err != nil {
return err
}
return os.Chmod(dst, stat.Mode())
}
func copy(dst, src string) error {
f, err := os.Open(src)
if err != nil {
return err
}
defer f.Close()
stat, err := f.Stat()
if err != nil {
return err
}
g, err := os.OpenFile(dst, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, stat.Mode())
if err != nil {
return err
}
defer g.Close()
_, err = io.Copy(g, f)
if err != nil {
return err
}
return os.Chmod(dst, stat.Mode())
}
func copy(dst, src string) error {
data, err := os.ReadFile(src)
if err != nil {
return err
}
stat, err := os.Stat(src)
if err != nil {
return err
}
return os.WriteFile(dst, data, stat.Mode())
}
new File(dst).bytes = new File(src).bytes
new File(src).withInputStream { input ->
new File(dst).withOutputStream {output ->
output << input
}
}
Files.copy(Path.of(src), Path.of(dst));
Success := CopyFile(src, dst);
cp($src, $dst) or die $!;
fs::copy(src, dst).unwrap();