How do you auto delete all files under a sub directory after x-time (let say after 24 hours) - without using a cronjob command from server or pl. How can you do this just using PHP code or by just visiting the page without clicking something and the command auto runs.
You can free up space and keep things organized by only deleting files that are older than a certain number of days in any folder — here's how to do it. To delete files older than 30 days on Windows 10, use the “ForFiles” command. The command is: ForFiles /p “C:\path\to\folder” /s /d -30 /c “cmd /c del /q @file”.
Storage Sense in Windows 10 is a new feature. When you enable it, Windows will automatically delete unused files when the computer is low on disk space. For instance, it can automatically delete files older than 30 or 60 days from the Recycle Bin or delete temporary files to free up some space.
I use shell AT command, it's like a cronjob though
php:
exec("echo rm /somedir/somefile.ext|at now +24 hours");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With