Skip to content

Codes #273

@siddharthrgade21-a11y

Description

@siddharthrgade21-a11y

import java.nio.file.*;
import java.io.IOException;

public class AdvancedFileIO {
public static void copyFile(String sourcePath, String destPath) {
Path source = Paths.get(sourcePath);
Path target = Paths.get(destPath);
try {
// StandardCopyOption.REPLACE_EXISTING ensures it overwrites if file exists
Files.copy(source, target, StandardCopyOption.REPLACE_EXISTING);
System.out.println("File copied successfully!");
} catch (IOException e) {
e.printStackTrace();
}
}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions