DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: how to delete text files that have less than x lines  (Read 5,325 times)

kalos

  • Member
  • Joined in 2006
  • **
  • Posts: 1,824
how to delete text files that have less than x lines
« on: September 11, 2007, 01:15 PM »
hello

how can I delete all the text files that have less than 3 lines inside a folder?

thanks

matt_man22

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 11
Re: how to delete text files that have less than x lines
« Reply #1 on: September 12, 2007, 06:20 PM »
I assume you are using Windows?

I know in linux it is a simple "wc -l" command.  Maybe that could help in some way.  Not sure how to do it in Windows.

AbteriX

  • Member #520
  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 1,150
Re: how to delete text files that have less than x lines
« Reply #2 on: September 12, 2007, 09:39 PM »
There are unix-tools-for-windows packs available and there are wc.exe included.

With plain DOS commands this is a lill bit difficult,
maybe "for /f" could help, loop this three times and if errorlevel >0 then delete this file <???>

Real solution would be an AutoHotkey script .... but you have asked this there already, so i will wait what happens.
Greetings, Stefan.

Original address: https://www.donationcoder.com/forum/index.php?topic=9945.0