Basic file copy command

Hi,

Long time user, first time poster. :smiley:

I've written scripts and commands to do all sorts of tricky things, but this most basic task has been eluding me today for an embarrassing length of time. :confused:

I just want to create a copy of a file with a new specified name, and either I'm missing something obvious or the internal COPY command doesn't work when given both a source and destination path.

e.g.

COPY "d:\test.txt" TO "d:\test_copy.txt"

I get an error message:

An error occurred copying "d:\test.txt":
The system cannot find the path specified.

If I omit the target file name it will copy the file to the destination lister, so I assume it's not the source path that's the problem.

Thanks for any help.

This should work:

COPY "d:\test.txt" TO "d:\" AS "test_copy.txt"

Oh! I knew it would be something simple, and it looks so obvious now.

May I suggest a similar example be added to a relevant part of the COPY page in the user manual?
There is nothing in there now to explain that the source folder and file name should be given as separate parameters (and it's a little unintuitive for anyone used to command line copy commands).

Thanks again. :slight_smile:

Bumping my own old thread... which I know is not great forum etiquette

In my defence, I've just wasted another two hours trying to work out why a simple copy command wasn't working because I forgot that you can't specify a fully qualified target path in the COPY AS command. :anguished:
And the error message doesn't include any information to indicate that as the cause.

So I'm again suggesting adding a comment or example to the user manual.

We've added a couple of short notes to the two arguments for the next version.