Page 1 of 1

How to simply delete files in a script ?

Posted: 27 Jan 2021 14:18
by Horst
I have a script to copy my XYplorer tree into some backup drive and path.
The copy works fine but after copying I try to delete the thumbnail files from this backup.
It doesn't work.
I can't find out how to simply delete files in a script without any active selections or other stuff.

Here is my script:

copyto "D:\backups\XYplorer_v<xyver> (on <date yyyy-mm-dd>)", "<xypath>", , , 2;
delete 0, 0, "D:\backups\XYplorer_v<xyver> (on <date yyyy-mm-dd>)\XYplorer\Data\Thumbnails\*.*";

Re: How to simply delete files in a script ?

Posted: 27 Jan 2021 14:41
by highend

Code: Select all

    $dst = "D:\backups\XYplorer_v<xyver> (on <date yyyy-mm-dd>)";
    setting "BackgroundFileOps", 0;
    copyto $dst, <xypath>, , 2, 2;
    delete 0, 0, $dst . "\XYplorer\Data\Thumbnails\*.*";
delete doesn't wait for anything (not until copyto has finished) without backgroundfileops turned off

Re: How to simply delete files in a script ?

Posted: 27 Jan 2021 14:54
by Horst
highend wrote: ↑27 Jan 2021 14:41

Code: Select all

    $dst = "D:\backups\XYplorer_v<xyver> (on <date yyyy-mm-dd>)";
    setting "BackgroundFileOps", 0;
    copyto $dst, <xypath>, , 2, 2;
    delete 0, 0, $dst . "\XYplorer\Data\Thumbnails\*.*";
delete doesn't wait for anything (not until copyto has finished) without backgroundfileops turned off
Thanks, you helped me again :D
I learned a lot in the past few days and start to love XYplorer even as I long time Total Commander user.
Normaly I do such backups with the ZPAQ archiver which does deduplicating and versioning in the archives.

Re: How to simply delete files in a script ?

Posted: 27 Jan 2021 15:06
by highend
Why didn't you use it (ZPAQ) this time?

Re: How to simply delete files in a script ?

Posted: 27 Jan 2021 15:28
by Horst
highend wrote: ↑27 Jan 2021 15:06 Why didn't you use it (ZPAQ) this time?
I did it already as follows in a Batch file
C:\Tools\ZPAQ\zpaq64.exe add D:\Backups\XYplorer.zpaq C:\tools\XYplorer -not C:\Tools\XYplorer\Data\Thumbnails\*

But I wanted one additional simple backup tree before doing some modifications
and also like to play a liitle bit more with YX features.

Re: How to simply delete files in a script ?

Posted: 27 Jan 2021 15:36
by highend
YX
You discovered another brand-new file manager? oO
Just kidding...

Re: How to simply delete files in a script ?

Posted: 27 Jan 2021 19:35
by klownboy
Hi Horst, have you considered using the sync command? It has an option using the "-" to not copy certain folders (e.g., the thumbnail folder). You are copying to new folders based on dates so I'd think it would work in your case. I use as it in a menu situation as follows, but you could adapt it to use your date based target folders.

Code: Select all

sync "D:\Tools\XYplorer", "O:\XYbackup", 1, 0, 1, "c",,"-D:\Tools\XYplorer\*Thumb*\"

Re: How to simply delete files in a script ?

Posted: 27 Jan 2021 19:49
by Horst
klownboy wrote: ↑27 Jan 2021 19:35 Hi Horst, have you considered using the sync command? It has an option using the "-" to not copy certain folders (e.g., the thumbnail folder). You are copying to new folders based on dates so I'd think it would work in your case. I use as it in a menu situation as follows, but you could adapt it to use your date based target folders.

Code: Select all

sync "D:\Tools\XYplorer", "O:\XYbackup", 1, 0, 1, "c",,"-D:\Tools\XYplorer\*Thumb*\"
Thanks for the tip.
I'll certainly have a look on the Sync function in one of my next scripting plans.