Software-OK
≡... News | ... Home | ... FAQ | Impressum | Contact | Listed at | Thank you |

  
HOME ► Faq ► FAQ - Command Prompt - Windows 11, 10, etc. ► ««« »»»

Deleting files with no content using a batch file, but how?


Deleting files without content with a batch file, command prompt, ... or via the address bar in File Explorer is quite popular!



Here you can find out. that it is quite easy to delete files without content on all Windows 11, 10, ... etc. Desktop and Microsoft Server operating systems!


Contents:

1.) ... example batch file for deleting files without content!
2.) ... Delete files via the command prompt 
3.) ... Delete example from the address line!
4.) ... Further tips for deleting the files!




1.) Sample batch file for deleting files without content!


Delete in the current working directory


forfiles /s /m *.* /c "cmd /c if @fsize equ 0 del @path"


@fsize  equ 0  is used to query whether the file is NULL bytes in size. 

Use /s only if you also want to delete subdirectories.   

More on ►►  FORFILES Parameter Explanations 
 
Another example specifying the folder and, for example, *.log files without content to be deleted in the folder including sub-folders.


forfiles /p "c:/The/Folder/" /s /m *.log /c "cmd /c if @fsize equ 0 del @path"




2.) Delete files via Command Prompt 

The above commands can also be started directly in the command prompt. If you do not specify the full folder path, always keep an eye on the working directory command prompt!

To do this ►► open  the input prompt in the desired directory !




3.) Delete the example from the address line!

forfiles is a very convenient command and can also be run from the File Explorer column or Quad Explorer column!

 For example for the current test directory on C:\ with cmd /k at the beginning

cmd /k forfiles /s /m *.log /c "cmd /c if @fsize equ 0 del @path"


(Image-1) Delete files without content from the file explorer address bar!
Delete files with no content from File Explorer address bar!

-
▲ Back to the top ▲



4.) More tips for deleting the files!

The deletion should be done with care. You can also start a file search in File Explorer and delete files with a size of ZERO!

►►  Search queries Windows 10/11 MS File Explorer (simple examples)?  

After the search is complete, just sort by size and delete NULL bytes. However, it is significantly more complex and not suitable for automation, for example. For example, if you want certain folders with empty files to be deleted on Windows startup!

►►  How can you start a batch file every time you start the computer?

Optionally, you can use the clipboard commands in tools like QTP to do
 
this ►► Importing text and Windows commands from the clipboard


Related FAQs: 

►► Delete files younger than date via command line!
►► Command line to delete empty folders Windows 11, 10, ....





FAQ 143: Updated on: 26 August 2023 11:00 Windows
Windows-Console

Searching in files by string via command prompt?


The classic search in files for a character string via the command prompt is hardly used anymore, but it is still available on Windows 11, 10, In order
Windows-Console

Is there a list of WMIC commands on MS Windows?


It is quite easy to have the MMIC commands listed on all Microsoft Windows desktop and MS servers and to obtain further information WMIC is deprecated The
Windows-Console

Realize dark mode switch with a batch file?


Why not simply implement the dark mode in Microsoft Windows 11 or 10 with a batch file at the push of a button and without an administrator query Everyone
Windows-Console

How and why do command lines work in CMD.EXE?


The command line in CMD.EXE, often also called console or terminal, is a text-based interface within the operating system that can make things a lot easier
Windows-Console

Schedule a webpage to open via the command prompt?


On MS Windows operating systems you can use SCHTASK to open a web page at a specific time, why not when its so easy Here are a few examples for the time-controlled
Windows-Console

Batch job file to cancel print jobs?


Looking for a batch job file to cancel print jobs, youve finally arrived at the problem-solving point and you can create or download it Contents: 1.
Windows-Console

Clear clipboard via command prompt!


If for some reason you want to clear clipboard from Command Prompt, you can try this command as a solution Contents: 1. Delete the clipboard via the

»»

  My question is not there in the FAQ
Asked questions on this answer:
  1. Delete Empty Files Prompt?
  2. Teaching Documents or Pictures Delete on Windows?
  3. Delete empty log files with script and automation?
Keywords: windows, console, deleting, files, with, content, using, batch, file, without, command, prompt, address, explorer, quite, popular, here, find, that, Questions, Answers, Software




  

  + Freeware
  + Order on the PC
  + File management
  + Automation
  + Office Tools
  + PC testing tools
  + Decoration and fun
  + Desktop-Clocks
  + Security

  + SoftwareOK Pages
  + Micro Staff
  + Freeware-1
  + Freeware-2
  + Freeware-3
  + FAQ
  + Downloads

  + Top
  + Desktop-OK
  + The Quad Explorer
  + Don't Sleep
  + Win-Scan-2-PDF
  + Quick-Text-Past
  + Print Folder Tree
  + Find Same Images
  + Experience-Index-OK
  + Font-View-OK


  + Freeware
  + 12-Ants
  + Q-Dir
  + PaintOkay
  + DirPrintOK
  + FontViewOK
  + MeinPlatz
  + DesktopOK
  + IsMyMemoryOK
  + StressTheGPU
  + PAD-s


Home | Thanks | Contact | Link me | FAQ | Settings | Windows 10 | gc24b | English-AV | Impressum | Translate | PayPal | PAD-s

 © 2025 by Nenad Hrg softwareok.de • softwareok.com • softwareok.com • softwareok.eu


► Convert the table into an image in Microsoft Word? ◄
► How can I see the Windows command line history in the cmd.exe? ◄
► Can I eject drive with this tool under Windows 11? ◄
► Reset local group policies under Windows 11, 10, ... via cms.exe! ◄


This website does not store personal data. However, third-party providers are used to display ads,
which are managed by Google and comply with the IAB Transparency and Consent Framework (IAB-TCF).
The CMP ID is 300 and can be individually customized at the bottom of the page.
more Infos & Privacy Policy

....