This code deletes all the empty files that are available in a particular directory using Java
This Code will help to check for all the empty files available in the particular folder and then delete all those files.
The user input gives the directory from where empty files are deleted.
Then that String input is given as a constructor parameter in the File Class object.
Ana array of File objects is created to store all the files.
Then I created a loop that will iterate on all the File objects and check for the length of the File and delete if the length is found to be zero.
So go try this code.
Submitted by Satvik Singh Sengar (satviksinghsengar)
Download packets of source code on Coders Packet
Comments