Button To Zip Then Delete

I currently have a button that will move files from one folder to another. Now I am looking for the code to add to that button that will zip that folder then delete it, leaving just the zipped file.

Any help would be greatly appreciated.

Shawn

Try this one, but in a test environment first. :wink:

COPY ARCHIVE=keepfolder HERE
Delete

You also can add the QUIET argument after the Delete.

1 Like

I added the code that you recommended, and it does nothing at all, but got me to thinking about another button that I had to zip files, and I came up with:

Copy ZIP=single "C:\Temp\PaleMoon\PaleMoon*" TO="C:\Temp\PaleMoon\"

Select DESELECT ~(*.zip)
Select ALLDIRS

DELETE

That works just like I wanted. Thanks for the help, I really appreciate it.

Shawn

works fine

That button deselects all non-zip files. Is that the intent?

Yes it is. The folder is only used for backups, and the newest backup will replace the old one.

Thanks.

Shawn

1 Like

I have run into a problem with my code. The way that I have it written works if I start the button in the folder that I want the zip file in. But if I push the button while in another folder it will make the zip file in the right folder, but delete everything but the zip files in the current folder.

Copy ZIP=single "C:\Temp\FireFox*" TO="C:\Temp\FireFox"

Select DESELECT ~(*.zip)"
Select ALLDIRS

DELETE

I tried using the code below, but nothing happens. It just makes the zip file as intended, but doesn't delete the original folder.

Copy ZIP=single "C:\Temp\FireFox*" TO="C:\Temp\FireFox"

Select DESELECT "C:\Temp\FireFox" ~(*.zip)"
Select ALLDIRS "C:\Temp\FireFox"

DELETE

What am I missing?

Although it doesn't show it in the preview after each FireFox is a \ .

Thanks.

Shawn

The delete command can be given paths and wildcards, or a filter (or even a full list of files, via scripting), to tell it what to delete.

The select command is for changing what's selected on-screen. It shouldn't be used to change what another command acts on; there are more direct ways to do that. You also can't select files in a folder you aren't viewing, because they aren't onscreen. (Scripting lets you build a list of files in any folder, and pass them to a command, if you want to use a similar approach. In most cases, wildcards are enough without needing scripting.)

Thanks for the answer.

I just added the following to have the buttton switch to the folder that I am working on. That way I don't have to mess around with learning how to script.

Go PATH="C:\Temp\FireFox"

Thanks again.

Shawn

1 Like