Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Copy file TFile and access denied



Permlink Replies: 4 - Last Post: Mar 15, 2018 9:21 AM Last Post By: Remy Lebeau (Te... Threads: [ Previous | Next ]
duf _

Posts: 28
Registered: 7/2/06
Copy file TFile and access denied
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 1, 2018 1:17 AM
Hello,
Please help me get a solution regarding the lack of access to the file when trying to copy or move. I created a simple file and I want to copy it to a folder and the program throws an error that I do not have access to the file
TFile::Copy( "D:\\a.txt", "D:\\A" );
Mark Richards

Posts: 42
Registered: 12/8/99
Re: Copy file TFile and access denied
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 1, 2018 2:16 AM   in response to: duf _ in response to: duf _
duf _ wrote:
Hello,
Please help me get a solution regarding the lack of access to the file when trying to copy or move. I created a simple file and I want to copy it to a folder and the program throws an error that I do not have access to the file
TFile::Copy( "D:\\a.txt", "D:\\A" );

I am not certain but you may have to give the destination a file name too. For example

I am assuming your DestFileName of D:
A is a folder?
TFile::Copy(L"D:\\a.txt", L"D:\\A\\a.txt);

You may always wish to add the Overwrite param if you want to overwrite if the file already exists in the destination.

TFile::Copy(L"D:\\a.txt", L"D:\\A\\a.txt, true);


Edited by: Mark Richards on Mar 1, 2018 9:34 AM

Edited by: Mark Richards on Mar 1, 2018 9:35 AM
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: Copy file TFile and access denied
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 1, 2018 9:30 AM   in response to: duf _ in response to: duf _
duf _ wrote:

I created a simple file and I want to copy it to a folder and the
program throws an error that I do not have access to the file

Do you have read/write permissions to the root of D:\ to begin with?
You might need admin rights to get access.

--
Remy Lebeau (TeamB)
Matthew Grayson

Posts: 8
Registered: 12/26/02
Re: Copy file TFile and access denied
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 15, 2018 2:57 AM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
Remy Lebeau (TeamB)

Greetings TeamB - I can't believe you still exist. Last time I posted for help I always looked for you. Sheesh that was nearly 15 or more years ago. I saw your handle and had to stop into this thread and say hi.

Yeah, he is probably having permission issues. He should attempt the copy in a terminal or cmd prompt by hand. See if the OS throws the same error. Or heck, even try doing it through the GUI. But he hasn't been back in two weeks so I bet he asked the question prematurely because he got tired of messing with it, figured it out and then didn't come back to conclude the thread. Oh well.

Side note - I'm gonna post a weird thing with TButton not letting a caption end with an explanation mark. I'm curious what you might add to that.

Great seeing ya man.

Matthew.
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: Copy file TFile and access denied
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 15, 2018 9:21 AM   in response to: Matthew Grayson in response to: Matthew Grayson
Matthew Grayson wrote:

Greetings TeamB - I can't believe you still exist.

Yeah, a few of us are still hanging around.

--
Remy Lebeau (TeamB)
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02