Results 1 to 10 of 10

Thread: App needs to write files from one driveX:\folder to another different driveY:\folder

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2009
    Location
    Anywhere I want to.
    Posts
    215

    App needs to write files from one driveX:\folder to another different driveY:\folder

    What methods should I use to get the fastest copy ?

    I have many large files I need to copy.

    Pass to some external program or use certain APIs with special settings ?

  2. #2
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    6,256

    Re: App needs to write files from one driveX:\folder to another different driveY:\fol

    You could use lower level APIs but I don't think the API being a few ms faster starting the copy will have any noticeable impact compared to the time it takes the physical disks to read and write. Have you found any programs that copy faster?

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Aug 2009
    Location
    Anywhere I want to.
    Posts
    215

    Re: App needs to write files from one driveX:\folder to another different driveY:\fol

    I thought I read decades ago that ...
    (1) there is a API fast copy that works on Vista and beyond
    (2) that windows does some copy double buffering that can be turned off
    (3) that using the correct copy buffers size for read and write related to the disk physical sector size was important
    (4) that the size of the copy buffer for read and write is important.
    (5) offloading the main app by passing the copy process to say an ActiveX.EXE

    How significant are these and other factors ?

  4. #4
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    6,256

    Re: App needs to write files from one driveX:\folder to another different driveY:\fol

    Find a program that actually copies faster, if one exists, then look at how.

    A lot of things that might have mattered for 80s or 90s hardware don't for modern drives.

    Maybe if you're trying to copy while under heavy load you could increase the priority of the process/thread above whatever is hogging the CPU/disk.

  5. #5
    Fanatic Member BenJones's Avatar
    Join Date
    Mar 2010
    Location
    Wales UK
    Posts
    719

    Re: App needs to write files from one driveX:\folder to another different driveY:\fol

    You chould ue an array andd copy the file in blocks I seen a lot of this done in the old Qbasic programs and some were fast. your other option if to write a low level code in C and call it from a dll I am not to sure but you may also ue the api functions WriteFile and ReadFile, or you chould save your self some time and make a pipe to xcopy on windows that does almost what you need and more.

  6. #6
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    4,736

    Re: App needs to write files from one driveX:\folder to another different driveY:\fol

    I would use CopyFileEx-API within an ActiveX-DLL
    1) It would run in its own Thread
    2) you could pass the callback via Event back to the calling Program, informing the user about progress
    Last edited by Zvoni; Tomorrow at 31:69 PM.
    ----------------------------------------------------------------------------------------

    One System to rule them all, One Code to find them,
    One IDE to bring them all, and to the Framework bind them,
    in the Land of Redmond, where the Windows lie
    ---------------------------------------------------------------------------------
    People call me crazy because i'm jumping out of perfectly fine airplanes.
    ---------------------------------------------------------------------------------
    Code is like a joke: If you have to explain it, it's bad

  7. #7
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    6,256

    Re: App needs to write files from one driveX:\folder to another different driveY:\fol

    Dont need an activex exe for something like that, just The trick's multithreading module. (Or of course, tB is thread safe and requires no hacks to call CreateThread)

  8. #8
    Frenzied Member VanGoghGaming's Avatar
    Join Date
    Jan 2020
    Location
    Eve Online - Mining, Missions & Market Trading!
    Posts
    2,005

    Re: App needs to write files from one driveX:\folder to another different driveY:\fol

    Being thread-safe doesn't mean much, synchronization is still a major pitfall of threading. By comparison, ActiveX EXEs are a breeze.

  9. #9
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    6,256

    Re: App needs to write files from one driveX:\folder to another different driveY:\fol

    This isn't many threads trying to coordinate the same task, it's just a single thread spun up for a single task.

    Maintaining a whole separate exe, active x no less, isn't really optimal imo. Most of us get by with a DoEvents to update the GUI and check for cancel clicks in the copy callback.

  10. #10
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    10,523

    Re: App needs to write files from one driveX:\folder to another different driveY:\fol

    One question that isn't clear to me ... are these files being copied from the same "box", just different drives, or:

    • Are they being copied from different drives or folders on a server?
    • Are they being copied from two entirely different "boxes", possibly locally-to-server (or vice-versa)?

    The answers to those questions can make a very large difference for the correct answer to your question.
    Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width