简体   繁体   中英

how windows cuts a file, change path or transfer full data

I wonder how windows cuts a file into another location ? does it change the file path only? or transfer the whole file data?

can you write a program in java to cut files in a fast way ?

When you use cut and paste with files, Windows will move the file if it's on the same device (disk partition, etc.). That is, it will just update the file system's record, it won't have to copy the file data.

You can use File#renameTo in Java to do the same thing, provided the OS can do so with the source and destination.

If you cut and paste a file across devices, Windows has to copy the file data (of course), and then delete the old file. File#renameTo won't do that; the rename will fail (it'll return false ) and you have to respond to that by doing the file copy (and then removal of the old file) yourself.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM