Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8800239
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T00:32:00+00:00 2026-06-14T00:32:00+00:00

Please help write in batch: On disk c:\ I have folder named test; in

  • 0

Please help write in batch:

On disk c:\ I have folder named test;
in this folder I have subfolders with different names.
I need batch command to loop through all subfolders, and look for files named “Log” and/or “sqlite.sql”; if those files size < 0 Kb or do not exist then delete this subfolder with all files without prompt.

for each sub in Test
 if Isfile("Log") or Isfile("sqlite.sql") and EachFileSizes > 0 Then 
 Else
 Sub.delete
 End If
next
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T00:32:02+00:00Added an answer on June 14, 2026 at 12:32 am

    The solution to this problem depends on the place of the subfolders. If they all are directly under C:\test (just one level deep), then this is the solution:

    @echo off
    setlocal EnableDelayedExpansion
    cd C:\test
    rem Process all subfolders
    for /D %%a in (*) do (
       rem Initially, set to delete this subfolder
       set delete=yes
       rem Confirm that
       for %%b in (%%a\Log %%a\sqlite.sql) do (
          set size=%%~Zb
          if !size! gtr 0 set delete=no
       )
       if !delete! equ yes (
          ECHO rd /S /Q %%a
       )
    )
    

    If subfolders may exist several levels deep beneath C:\test, then the solution is much more complicated.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Please help me to write the following sql. I have a table like this,
I have one folder named test located at www.mydomain.com/abc/files/test. I need to change the
Can you please help me to write a sed command to remove the price
Please help me re-write this code sample in PHP to C#: $stringArray = array();
I need some help to write some queries. For this sql query (select *
Please help me to write this code i want to display table like this
Can somebody please help me to write a DeepCopy routine for this matrix class
Please help me write LINQ for this SQL select svc.SvcName, svcOptions.SvcOptionName, svcMap.Price from svcMap
Anyone please help me to write test case for 100% code coverage for following
java experts can you please help me write detached queries as a part of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.