How to simply delete files in a script ?

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
Horst
Posts: 1419
Joined: 24 Jan 2021 12:27
Location: Germany

How to simply delete files in a script ?

Post 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\*.*";
Windows 11 Home, Version 26H2 (OS Build 26300.10075)
Portable x64 XYplorer (Actual version, including betas)
Display settings 1920 x 1080 Scale 100%
Everything 1.5.0.1424b (x64), Everything Toolbar 3.5, Listary Pro 7.1.0.47 beta

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

Re: How to simply delete files in a script ?

Post 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
One of my scripts helped you out? Please donate via Paypal

Horst
Posts: 1419
Joined: 24 Jan 2021 12:27
Location: Germany

Re: How to simply delete files in a script ?

Post 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.
Windows 11 Home, Version 26H2 (OS Build 26300.10075)
Portable x64 XYplorer (Actual version, including betas)
Display settings 1920 x 1080 Scale 100%
Everything 1.5.0.1424b (x64), Everything Toolbar 3.5, Listary Pro 7.1.0.47 beta

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

Re: How to simply delete files in a script ?

Post by highend »

Why didn't you use it (ZPAQ) this time?
One of my scripts helped you out? Please donate via Paypal

Horst
Posts: 1419
Joined: 24 Jan 2021 12:27
Location: Germany

Re: How to simply delete files in a script ?

Post 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.
Windows 11 Home, Version 26H2 (OS Build 26300.10075)
Portable x64 XYplorer (Actual version, including betas)
Display settings 1920 x 1080 Scale 100%
Everything 1.5.0.1424b (x64), Everything Toolbar 3.5, Listary Pro 7.1.0.47 beta

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

Re: How to simply delete files in a script ?

Post by highend »

YX
You discovered another brand-new file manager? oO
Just kidding...
One of my scripts helped you out? Please donate via Paypal

klownboy
Posts: 4481
Joined: 28 Feb 2012 19:27
Location: Windows 11, 25H2 Build 26200.8737 at 100% 2560x1440

Re: How to simply delete files in a script ?

Post 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*\"

Horst
Posts: 1419
Joined: 24 Jan 2021 12:27
Location: Germany

Re: How to simply delete files in a script ?

Post 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.
Windows 11 Home, Version 26H2 (OS Build 26300.10075)
Portable x64 XYplorer (Actual version, including betas)
Display settings 1920 x 1080 Scale 100%
Everything 1.5.0.1424b (x64), Everything Toolbar 3.5, Listary Pro 7.1.0.47 beta

Post Reply