Magic Posted February 23, 2005 Report Share Posted February 23, 2005 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. Grtz Magic Quote Link to comment Share on other sites More sharing options...
IceBox Posted February 23, 2005 Report Share Posted February 23, 2005 Use the "Delete File or Files" command. Set 3 integer variables for the date: e.g. 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 Or If N1 = 3 Or If N1 = 5 Or If N1 = 7 Or If N1 = 8 Or If N1 = 10 Or 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! Quote Link to comment Share on other sites More sharing options...
randallc Posted February 24, 2005 Report Share Posted February 24, 2005 (edited) 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; <DT:m.d.yyyyT:02:3:{P00001}{P00000}{P00000}{P00000}><DOFILE:08:NN:c:\Backup\FolderName\*%T2%.txt> 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 DatebillGap2.mxe Edited May 9, 2005 by randallc Quote Link to comment Share on other sites More sharing options...
Magic Posted February 24, 2005 Author Report Share Posted February 24, 2005 I thought this would be a tough one but I've got enough info to start something! Thanks for all the info/tips! Quote Link to comment Share on other sites More sharing options...
IceBox Posted February 24, 2005 Report Share Posted February 24, 2005 Thanks randall! I knew I was probably making it too difficult. I think I like your 2 command approach better than my 50 - 60 command approach Quote Link to comment Share on other sites More sharing options...
Magic Posted February 24, 2005 Author Report Share Posted February 24, 2005 Randall, you lose me on the //Set one day back in dialog box*** part. I don't find it? Grtz, Magic Quote Link to comment Share on other sites More sharing options...
randallc Posted February 24, 2005 Report Share Posted February 24, 2005 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 <DT:m.d.yyyyT:02:3:{P00001}{P00000}{P00000}{P00000}><DOFILE:08:NN:c:\Backup\FolderName\*%T2%.txt>> (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 Picture Quote Link to comment Share on other sites More sharing options...
Magic Posted February 26, 2005 Author Report Share Posted February 26, 2005 Randall, it works! Bloody hell! Thank you very very much! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.