Jump to content
Macro Express Forums

Delete Backup Files?


Recommended Posts

Hi there,


I've a question about a macro:

Is it possible to delete backup files? (I'll explain it ;))


With MozBackup I create a backup of my Firefox and Thunderbird profiles everyday.

They get the name: Firefox 1.0 (en-US) - 2.23.2005.pcv and Thunderbird 1.0 (en) - 2.23.2005.pcv


As you can see in the filename the date (so tomorrow it will be 2.24.2005.pcv) is present, is it possible to let ME delete those files after I made new backups?


I already have a macro which makes the backups.




Link to comment
Share on other sites

Use the "Delete File or Files" command. Set 3 integer variables for the date:



N1 - Set from current month

N2 - Set from current day

N3 - Set from current year


You would then have to go back 1 day:


N2 = N2 - 1


And then you would need to write some extra code to make sure it corrects itself on the first of the month. Something like...


If N2 = 0 (This is what N2 would now be after you have subtracted 1 from it)

N1 = N1 - 1

End If


Then you need to change the day to 28, 30, or 31, depending on the month. Use variables for this too:


(The following commands would have to be included inside the "If N2 = 0" command above)


If N1 = 1


If N1 = 3


If N1 = 5


If N1 = 7


If N1 = 8


If N1 = 10


If N1 = 12

N2 = 31

End If


Then do the same for the 30 day months and the same for February.


Once you have the dates squared away... you would delete the files named:


Firefox 1.0 (en-US) - %N1%.%N2%.%N3%.pcv

Thunderbird 1.0 (en-US) - %N1%.%N2%.%N3%.pcv



Now after typing all that, I hope I didn't confuse the issue. Maybe there is a much easier way to do this, and if so, somebody please correct me. Otherwise, I hope this helps!

Link to comment
Share on other sites

Hi guys,

I think I have a simpler solution, as I found for my date/time differences macro;

Dates Discussion

The format is easier to set in Text/Date/Time command;


Date/Time: Save "m.d.yyyy" into %T2% //Set one day back in dialog box***

Delete File or Files: "*%T2%.pcv"

Best, Randall

PS Here's a much more complex example; see my signature "Date Formats", links to explain;\EDIT2; updated file


Edited by randallc
Link to comment
Share on other sites

Hi, Magic,


I'm presuming you want to retrieve yesterday's date to delete yesterday's backup?


That's already set if copy the "code" from this post.


When you use the command (or double click on it in your macro having pasted it in ), you will see various options to set inside the "Text/Date/Time Format" command, including 4 boxes for "Days back, hours back, months back etc."


(There are also options to use a certain date or to prompt at run-time as alternatives; you can change the date format in the top box))


Best, Randall




(PS in the code you can see it as the first "{P00000}" option, which has been set to "{P00001}"

(I'll try to add apicture here, but have not done it before, so may not work!

Prompt PictureDateTimePrompt.jpg

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...