Java Copying and Moving Files using path

Java Copying and Moving Files using path


copyTo method to copy file to target location
• Options to replace existing file, copy file attributes...

moveTo method to move file to target location
• Option to replace existing file
• Option to require operation to be atomic

import static java.nio.file.StandardCopyOption.*;
Path source = Path.get("C:\\My Documents\\Stuff.odp");
Path target = Path.get("D:\\Backup\\MyStuff.odp");
source.copyTo(target);
source.copyTo(target, REPLACE_EXISTING, COPY_ATTRIBUTES);

Comments

Popular posts from this blog

I get wrong characters when retreiving the message body of an email using TIdIMAP4.UIDRetrieveTextPeek2()

How to drop the all the 1's in a correlation matrix

Today Walkin 14th-Sept