script copy file

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
swan_x
Posts: 335
Joined: 08 Oct 2009 12:27

script copy file

Post by swan_x »

i have file 555.txt in C: and i want with a script one copy of this in D: and OverwriteExisting (for continuous backup)

i've tried this script
Copy "C:\555.txt" "D:\" OverwriteExisting

but have this error
<None of the items to copy does exist>

why???

highend
Posts: 14942
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: script copy file

Post by highend »

You've read the help file?

Code: Select all

copy

Copies item(s) to the clipboard.
and now read the entry for backupto
One of my scripts helped you out? Please donate via Paypal

swan_x
Posts: 335
Joined: 08 Oct 2009 12:27

Re: script copy file

Post by swan_x »

ok tnxs for reply....but was no longer simply a practical example???

swan_x
Posts: 335
Joined: 08 Oct 2009 12:27

Re: script copy file

Post by swan_x »

this script work fine:

backupto "D:\", "C:\555.txt", 2

but now i have 2 files....555.txt & 666.txt

with backupto "D:\", "C:\*.txt", 2 don't copy nothing!!

with backupto "D:\", "C:\*.*", 2 don't copy nothing!!

where is my error???

RalphM
Posts: 2089
Joined: 27 Jan 2005 23:38
Location: Cairns, Australia

Re: script copy file

Post by RalphM »

A quick guess is your quoting.
You wan't the *.txt to be expanded at runtime, but with "quoting" it's taken as is...

Edit: Sorry, I was wrong. See the following excerpt from Help on Scripting Command moveto:

Code: Select all

In the case of copyto and moveto, the source(s) may contain wildcards, for example: 
copyto "D:\Backup\XY files\<date yyyy-mm-dd>", "<xydata>\*.ini|<xydata>\*.dat"
Copies all *.ini and *dat file from the XYplorer data path to D:\Backup\XY files\2008-04-22\ (if that's the date today).
Note that backupto, however, does not support wildcards!
Especially the last sentence!
So, you either have to switch to copyto instead or list your two files separately.
Ralph :)
(OS: W11 25H2 Home x64 - XY: Current x64 beta - Office 2024 64-bit - Display: 1920x1080 @ 125%)

swan_x
Posts: 335
Joined: 08 Oct 2009 12:27

Re: script copy file

Post by swan_x »

no, no, no...

<backupto, however, does not support wildcards> ok but now i have 2 file with same extension.....txt
this trick not work if i have 2 different file (from backupto)

but with the script
backupto "D:\", "C:\*.txt", 2

should copy the 2 files, but you do not copy anything!!!

swan_x
Posts: 335
Joined: 08 Oct 2009 12:27

Re: script copy file

Post by swan_x »


Post Reply