File Operations - Copy and Move - Delphi
17,145
If you use Windows.pas' CopyFile(PChar(sFrom),PChar(sTo),false)
it will return false when the copy fails, and GetLastError
will return an error-code explaining why.
Related videos on Youtube
Author by
t j
Updated on September 21, 2022Comments
-
t j over 1 year
I need to do a two fold operation in Delphi.
First is reading a directory and copy all of the files into a backup folder. If any of the files are currently in use as being written to and/or open, then bypass that file.
Second is to move the file to another directory. Again, if any of the files are currently in use as being written to and/or open, then bypass that file.
I have used file copy and move before, but I am unsure as to how to detect whether a file is being written to and/or open.
Thanks.