Article

From:
To:
Muhammad Momin Rashid
Subject:
Re: How can I skip a file in use, while copying a directory, using SHFileOperation
Newsgroup:
borland.public.delphi.nativeapi

Re: How can I skip a file in use, while copying a directory, using SHFileOperation

Found some samples using google.

 Procedure MyFileCopyOperation;  Begin
    {some code here}
    try         SHFileOperation( ... );     except         On Exception do             { Exception Handling code here (if required) };         end;     End;
  { some code here}
End;
Search String I used: http://www.google.com/search?num=100&hl=en&lr=&ie=UTF-8&oe=UTF-8&safe=off&q= exception+handling+delphi
Regards, Muhammad Momin Rashid
"Muhammad Momin Rashid" <✉hotmail.com> wrote in message
news:✉newsgroups.borland.com...
> Look into exception handling.  In C++ Builder (sorry I don't have access to
> Delphi right now), you can simply solve the problem by enclosing the File
> Copy Function in "try ... catch" block.  Let me try to explain the concept
>
> ***Your Function Starts***
> // some code here
>
>     try
>     {
>         SHFileOperation
>     }
>     catch (Exception &E)
>     {
>         // error handling code here (if required), otherwise leave empty
>     }
>
> // remaining code
>
> ***Your Function Ends***
>
> Hope this helps
> Regards,
> Muhammad Momin Rashid.
>
> "Magnus van Aardt" <✉srcc.co.za> wrote in message
> news:✉newsgroups.borland.com...
> >
> > Seems solving one problem leads to another. I'm new to API so please bear
> > with me.
> >
> >
> >
> > I use SHFileOperation Function to copy all the files and sub directories
> > from a shared Folder across a network, to a local directory.
> >
> > It works fine, except for the following problem:
> >
> >
> >
> > -         Cannot copy <FileName>. Process cannot Access the file because
> > another process has locked a portion of the file.
> >
> >
> >
> > As soon as the above error occurs the entire copy procedure is canceled.
> How
> > can I just skip over the locked file and continue to copy the other files
> in
> > the directory. Does it mean that I need to check every file, to see if it
> is
> > in use, and then call the SHFileOperation to copy the file if not in use?
> >
> >
> >
> > Can anyone help me to solve this problem?
> >
> >
> >
>
>
FYI: Phrase searches are enclosed in either single or double quotes
 
 
Originally created by
Tamarack Associates
Thu, 28 Mar 2024 19:54:11 UTC
Copyright © 2009-2024
HREF Tools Corp.