Delete contents of Sub-folder after Time Frame ?

Discuss and share scripts and script files...
CookieMonster

Re: Delete contents of Sub-folder after Time Frame ?

Post by CookieMonster »

Enternal wrote:Yeah it's not possible to completely run the script with just XYplorer like many have said. Autohotkey is a great idea to rerun the script over a certain time period. Here's an example:

Code: Select all

#Persistent
InputBox, TimeMinutes, Minutes, How Many Minutes to Rerun?, , 250, 100
If TimeMinutes Is Not Number
	{
	MsgBox, Invalid Value for Minutes. Cannot Continue.
	ExitApp
	}
TimeMilli := TimeMinutes*60*1000

SetTimer, RunApp, %TimeMilli%
Return

RunApp:
;FormatTime, TimeString, , Time
;MsgBox, The Current Time is %TimeString%
Run, Application.exe
Return
There isn't a directory in that script that should be entered that is to be deleted after XX days/weeks in the script, or must I squeeze it in ? This script from the looks of it, is only running a program after a Time Frame ?

binocular222
Posts: 1423
Joined: 04 Nov 2008 05:35
Location: Win11, Win10, 100% Scaling

Re: Delete contents of Sub-folder after Time Frame ?

Post by binocular222 »

I hate GUI, so, the AHK script would look like this:

Code: Select all

;#notrayicon   ;uncomment this line if you hate tray icon
#Persistent
SetTimer, RunApp, 3600000       ;3600000ms = 1 hour
Return

RunApp:
Loop, %A_AppData%\Microsoft\Office\Recent\*.*     ;Place any folder path here
FileDelete, %A_LoopFileFullPath%
I'm a casual coder using AHK language. All of my xys scripts:
http://www.xyplorer.com/xyfc/viewtopic. ... 243#p82488

CookieMonster

Re: Delete contents of Sub-folder after Time Frame ?

Post by CookieMonster »

It looks like to me this script as well, is only running a program then deleting the files for that program, am I missing something ?

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

Re: Delete contents of Sub-folder after Time Frame ?

Post by highend »

Interesting. I don't see any app at all. Maybe you should try to look into a documentation? Loop, <folder> is a loop over file(s) / folder. What's missing in any of these scripts? Timeframes.

This is not a general discussion board about AHK or other scripting languages (they have their own)...
One of my scripts helped you out? Please donate via Paypal

binocular222
Posts: 1423
Joined: 04 Nov 2008 05:35
Location: Win11, Win10, 100% Scaling

Re: Delete contents of Sub-folder after Time Frame ?

Post by binocular222 »

The script in my post does not run any app at all.
It delete all files in %AppData%\Microsoft\Office\Recent\
every 1hr.
@Cookie: For simple script like this, you can refer to AHK help file.
I'm a casual coder using AHK language. All of my xys scripts:
http://www.xyplorer.com/xyfc/viewtopic. ... 243#p82488

Post Reply