Java - copy JPG while preserving all file attributes
问题 What is the best way to move/copy file while maintaining all its attributes (Date created, Date, etc)? Thank you 回答1: If you are using Java 7, use java.nio.file.Files.copy(Path source, Path target, CopyOption... options) Use the COPY_ATTRIBUTES option to maintain the last modified time: COPY_ATTRIBUTES Attempts to copy the file attributes associated with this file to the target file. The exact file attributes that are copied is platform and file system dependent and therefore unspecified.