Link to home
Start Free TrialLog in
Avatar of Eyooper
Eyooper

asked on

CopyFile access denied

I'm writting a File Manager program in MASM assembler.
Everthing is looking fairly good, I have a tree view and two
list views and a toolbar with the volume icons. I can change
the display to a tree view and one list view or just two list views.

The problem is I would like to copy files or folders from one
list view to the other. I can do it by using readfile and writefile,
but I would like to use the CopyFile function. When I try to use
it I get an access denied error. I've changed the source file to
read only access, but it still didn't work.

Do I need to do a CreateFile?

My command is:

INVOKE     CopyFile, addr InFile, addr OutFile, FALSE

The source and destination paths look ok.

Thanks;
Avatar of Eyooper
Eyooper

ASKER

I don't know what happen but it started working.
What should We can do now ?
Avatar of Eyooper

ASKER

CopyFile works ok now, is there a simple way to copy directories?  
ASKER CERTIFIED SOLUTION
Avatar of basant
basant

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Eyooper

ASKER

Thanks the xcopy works ok. But what can I do about the hidden
or system files or hidden directories within the directory that is
being copied? Is there a way to intercept the file or directory
that is being copied so I can change the attributes?

Thanks;
Avatar of Eyooper

ASKER

I have decided to use the SHFileOperation function instead of
copyfile and xcopy for my copy, move, rename, and delete
operations. I have only tried the copy portion of the SHFileOperation and everthing looks ok it copied hidden and system files, hidden subdirectories and all of the other good stuff.

But when I copy a folder with several files within the folder and the destination path has the same folder and files I get a Confirm Folder Replace msg box, so far so good, then I get a
Confirm File Replace msg box with a YES and  YES TO ALL
buttons. When I press the YES button I would think that the
Confirm File Replace msg box would appear for the next duplicated file, but it dosn't it just replaces the rest of the files. It acts like I pressed the YES TO ALL button. I'm I missing something?

Thanks;
/H option of xcopy copies hidden and
system file too.

>Is there a way to intercept the file or directory
that is being copied so I can change the attributes?

Options :
/R           Overwrites read-only files.
Avatar of Eyooper

ASKER

I found the problem with the SHFileOperation function (Confirm File Replace msg box).

I tried the xcopy with the /H, /R options and the it worked as
designed. Where can I find documentation for the /H and /R
options?
OK now I have a Problem both the SHFileOperation function
and the xcopy do what I need to have done. If you were me
which one would you use?
I will close this question after your answer.

Thanks again;
Use xcopy /?

I hope you knew it.
Avatar of Eyooper

ASKER

You can close this question.