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 6927227
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:01:26+00:00 2026-05-27T11:01:26+00:00

I have an app that successfully gets root access and executes 2 simple commands;

  • 0

I have an app that successfully gets root access and executes 2 simple commands; cd / and du. I’m not even sure if the cd is necessary because I think that’s where you end up after you su. But anyways.. running du prints out a lot of info. What I want to do is something() whenever I discover a folder with a size of zero. Am I going to have to walk through and query every folder manually, or is there some way to “listen” to the du output and act on it? I’m pretty good at scripting, but I know little about running Linux commands from an application…

FYI I’m using a slightly modified version of this example to run my commands.

Update

Here’s what I have so far… du prints out something like

205244    ./data
0         ./dev

So if use du | cut -c1 | grep '0' I get a bunch of zeroes. This is good.. I think. But now that I’ve narrowed the list to entries with 0 in the 1st column, how would I use grep and cut to only print the path of 0-size directories?

Also, is cut -c1 going to be reliable? Could there be a case where the dir wasn’t 0-size but had a leading zero in the output?

  • 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-05-27T11:01:26+00:00Added an answer on May 27, 2026 at 11:01 am

    I suggest you to try this.
    Be warned: it is recursive.

    find ./ -type d -empty -exec ls -ld {} \;
    

    please manually check the output is right before attempting to apply your something() 🙂

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

Sidebar

Related Questions

I have an app that executes commands on a Linux server via SSH just
have an app that finds your GPS location successfully, but I need to be
I have a Rails app that I have successfully tested with Mongrel and Webkit.
I have successfully created an app that reads from a bundled .plist file and
I have developed an app that has work successfully for the last 4 months
I have created a .Net application to run on an App Server that gets
I have successfully created an Android app that calculates prices and then is able
I have an app that successfully uses Facebook's single sign on to log a
I have deployed a Silverlight 5 PivotViewer web app that runs successfully on the
Have an app that has listings - think classified ads - and each listing

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.