Benefits of a Website Redesign
In today’s digital age, a website is often the first point of contact between a business and its potential customers. As trends and technologies evolve, it is crucial to ensure that your website
Read More
How to delete all files and sub-folders from a folder using php. Like deleting all files of a user without activity for long time, deleting files older than 3 months etc. Whatever the reason, doing such clean-up manually is a tedious task. You can accomplish it with the help of an automated php script. And we are going to explain how to delete directory and all files and sub directories from it with php.
glob() and unlink() only two native php functions.
Here is the simple php function I have written to delete all files from a directory. Next we loop through the files one by one and check if the item is a file and not a sub folder itself using is_file() function.
Delete only Particular file type for Eg:pdf, Jpg. with the file extension name user can delete only particular file type from the folder.
Deleteing old and unwanted files by setting CRON job user can delete the files older then 90days.
Simply deleting a folder with rmdir() won't work. it'll throw exception if you plan to remove folder with files in it. So first you've got to delete files one by one from each sub folder plus the remainder of the files then delete folders by removing parent folder.
In today’s digital age, a website is often the first point of contact between a business and its potential customers. As trends and technologies evolve, it is crucial to ensure that your website
Read MoreThanks to artificial intelligence (AI), the healthcare sector is going through a radical change. AI-powered software is changing the way healthcare is provided, from precise diagnoses to individualize
Read MoreOne of the oldest and most dynamic industries in the world, the textile and apparel sector is always changing to satisfy consumer needs. ERP (Enterprise Resource Planning) software is becoming a cruci
Read More