Delete all files when date arrives

gicimi

New Member
Joined
Mar 14, 2019
Messages
12
Hello,


files with the extension on the specified date need automatic deletion.

[FONT=&quot].csv.pdf.xla.xlam.xls.xls.xlsb.xlsm.xlsx[/FONT][FONT=&quot]

[/FONT]
can you help me?
****** id="cke_pastebin" style="position: absolute; top: 72px; width: 1px; height: 1px; overflow: hidden; left: -1000px;">can you help me</body>
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Welcome to the forum - your explanation is very short - is this what you want ?

:warning::warning: You cannot undo this - so be very careful :warning::warning:

If the date today is after 25 August delete all files in folder C:\Folder\SubFolder with extensions .csv .pdf .xla .xlam .xls .xls .xlsb .xlsm .xlsx

Code:
Sub DeleteFiles()
    Dim Ext As Variant
    If Date [COLOR=#006400]>[/COLOR] CDate("[COLOR=#006400]25 August 2019[/COLOR]") Then
        For Each Ext In Split("[COLOR=#0000cd].csv .pdf .xla .xlam .xls .xls .xlsb .xlsm .xlsx[/COLOR]")
            On Error Resume Next
            Kill "[COLOR=#ff0000]C:\Folder\SubFolder\*[/COLOR]" & Ext
            On Error GoTo 0
        Next
    End If
End Sub
 
Last edited:
Upvote 0
Hello,

It is not such much their extensions ... but their respective locations you will have to monitor in order to run your macro ...:wink:
 
Upvote 0
@gicimi
Please do not post the same question multiple times. All clarifications, follow-ups, and bumps should be posted back to the original thread.
Per forum rules, posts of a duplicate nature will be locked or deleted (rule 12 here: Forum Rules).

I have merged both your threads
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,190
Members
452,616
Latest member
intern444

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top