Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 198813
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T16:58:11+00:00 2026-05-11T16:58:11+00:00

The facts: When a file is moved, there’s two possibilities: The source and destination

  • 0

The facts:

When a file is moved, there’s two possibilities:

  1. The source and destination file are on the same partition and only the file system index is updated
  2. The source and destination are on two different file system and the file need to be moved byte per byte. (aka copy on move)

The question:

How can I determine if a file will be either logically or physically moved ?

I’m transferring large files (700+ megs) and would adopt a different behaviors for each situation.


Edit:

I’ve already coded a moving file dialog with a worker thread that perform the blocking io call to copy the file a meg at a time. It provide information to the user like rough estimate of the remaining time and transfer rate.

The problem is: how do I know if the file can be moved logically before trying to move it physically ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T16:58:11+00:00Added an answer on May 11, 2026 at 4:58 pm

    Ok I’m on something 🙂

    Using JNA I am able to call the Win32 API (and *nix API too) from java.

    I tried calling GetFileInformationByHandle and did got a result BUT the dwVolumeSerialNumber attribute always equals 0 (tried with my C: and D: drive)

    Then I saw this function on MSDN: MoveFileEx. When the flag parametter is set to 0, the copy on move feature will be disable. AND IT WORKS !!!!

    So I will simply call

    if (!Kernel32.INSTANCE.MoveFileEx(source.getAbsolutePath(), destination.getAbsolutePath(), 0)) {
        System.out.println("logical move failed");
    }
    

    Here is the code to put in the Kernel32.java interface (this file can be found in the src.zip package in the download section of the JNA site):

    boolean MoveFileEx(String lpExistingFileName, String lpNewFileName, int dwFlags);
    
    int MOVEFILE_REPLACE_EXISTING = 0x01;
    int MOVEFILE_COPY_ALLOWED = 0x02;
    int MOVEFILE_CREATE_HARDLINK = 0x04;
    int MOVEFILE_WRITE_THROUGH = 0x08;
    int MOVEFILE_DELAY_UNTIL_REBOOT = 0x10;
    int MOVEFILE_FAIL_IF_NOT_TRACKABLE = 0x20;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The MSDN documentation is (somewhat) clear about the following two facts about GDI Pens:
I have a dimension (SiteItem) has two important facts: perUserClicks perBrowserClicks however, within this
I have a log file with lines like this: ...timestamp...(id=1234)..GO... ...timestamp...(id=1234)..DONE... Facts: timestamps are
I'd like to utilize an ICE Faces fileInput control to fill in the file
I am currently looking in to some file uploading using Java Server Faces. I've
Like : using ::size_t; using ::fpos_t; using ::FILE; In fact it's a question inspired
I've been hearing conflicting facts about this topic. What is correct?
I want to scrape a list of facts from simple website. Each one of
We've all read the benchmarks and know the facts - event-based asynchronous network servers
I am trying to create some rules and facts on a certain situation. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.