My goal is to move the file from one directory to another. The source is on the local drive, and the destination is on the network drive. It doesn't matter if I move or copy and then delete the source. The file is about 6 GB.
What I tried:
File source = new File(localRoot + backup);
File dest = new File(storageRoot + "/" + storagePath + "/" + backup);
try {
log("Copying");
FileUtils.copyFileToDirectory(source, dest);
log("copied");
} catch (Exception e) {
e.printStackTrace();
}
File source = new File(localRoot + backup);
File dest = new File(storageRoot + "/" + storagePath + "/" + backup);
try {
log("Copying");
Files.copy(source.toPath(), dest.toPath());
log("copied")
} catch (Exception e) {
e.printStackTrace();
}
I also tried a manual method using Input, OutputStreams and reading bytes.
The results are that the file is created at the destination with the correct file name with 0 bytes, and the original file is overwritten from 6 GB to 0 bytes. This happens for all the methods I tried, the only exception is that when I tried to move, the original file was deleted and not overwritten.
, , .
, ?