Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Move file within volume without moving phisical file  (Read 992 times)

0 Members and 1 Guest are viewing this topic.

TIR1

    Topic Starter


    Newbie

    • Experience: Beginner
    • OS: Unknown
    Move file within volume without moving phisical file
    « on: June 13, 2012, 06:08:07 AM »
    Does anyone know if it is possible to move a file within a volume without having to move the physical file especially if it is very large.

    In windows there are a set of API calls is there something similar?  If anyone knows a similar command to MOVEFILEWRITETHRU?

    Thanks

    Rob
    « Last Edit: June 13, 2012, 06:20:43 AM by TIR1 »

    BC_Programmer


      Mastermind
    • Life is not static. It is an instance method.
    • Thanked: 763
      • Yes
      • Yes
      • BC-Programming.com
    • Certifications: List
    • Computer: Specs
    • Experience: Beginner
    • OS: Windows 7
    Re: Move file within volume without moving phisical file
    « Reply #1 on: June 13, 2012, 12:48:22 PM »
    mv and rename both do this, just like the windows/DOS "move" command. the win32 API MoveFile() and MoveFileEx() both change the directory location of a file but do not move the clusters of the file if the source and destination are on the same volume, just like if you use any of the standard library stdlib functions such as rename().

    The MOVEFILE_WRITE_THROUGH flag for the Win32 MoveFileEx() only affects file moves between volumes which are handled as a copy followed by a delete, and make sure that I/O is flushed to disk before the operation returns.

    the stdio C Function rename() can move files to new directories on the same volume.
    I was trying to dereference Null Pointers before it was cool.