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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T05:59:21+00:00 2026-06-16T05:59:21+00:00

Recently (that is in winter in few days) I wrote a simple script which

  • 0

Recently (that is in winter in few days) I wrote a simple script which packs some folders, script is listed below:

#!/bin/bash 
for DIR in `find -name "MY_NAME*" -type d`
do
tar -zcvf $DIR.tar.gz $DIR &
done
echo "Packing is done" > packing.txt

It works fine except that it searches for MY_NAME* in every sub-directory of the folder where it runs.
Because MY_NAME* folders contain lots of files, and packing takes long hours, I want to limit time loss and I want the find command to find those MY_NAME* directories only within the folder where the script is running (without sub-directories). Is it possible with command find ?

  • 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-16T05:59:22+00:00Added an answer on June 16, 2026 at 5:59 am

    It seems you want to use the -maxdepth flag on the find command:

    find -name "MY_NAME*" -type d -maxdepth 1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just a quick one - I wrote a php script recently that dynamically creates
I've found recently that for some types of financial calculations that the following pattern
I noticed recently that the project files my text editors use (along with some
I came across some code recently that used a custom error handler to turn
This is a (hopefully) really simple question - I have been told recently that
I've noticed recently that there's a few java libs (the JDK, joda time, iText)
I had a frustrating problem recently that boiled down to a very simple coding
My Android application does some calculations, but I noticed recently that if I were
I ran across some C++ code recently that typedef ed a struct in a
I've come across a few examples recently that do things like: <dl> <dt>Full Name:</dt>

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.