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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T12:42:25+00:00 2026-06-14T12:42:25+00:00

Having trouble listing the contents of a folder I’m not in, while excluding the

  • 0

Having trouble listing the contents of a folder I’m not in, while excluding the actual folder name itself.

ex:

root@vps [~]# find ~/test -type d
/root/test
/root/test/test1

However I want it to only display /test1, as the example.

Thoughts?

  • 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-14T12:42:27+00:00Added an answer on June 14, 2026 at 12:42 pm

    You can do that with -exec and basename:

    find ~/test -type d -exec basename {} \;
    

    Explanation:

    • The find ~/test -type d part finds all directories recursively under ~/test, as you already know.
    • The -exec basename {} \; part runs the basename command on {}, which is where all the results from the last step are substituted into.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having some trouble with listing the contents of a complex array. The array
Having trouble rewriting the name of a flash file: /flash/shell.1257347618.swf (the numbers are a
having trouble deciding whether or not it makes sense to put paging information about
I've having trouble with nested while loops. I've created this function to list three
I'm having trouble listing all the tables in a certain database in vb.net: Public
I'm having some trouble with the django generic object_list function's pagination not really being
I run a lost and found pet website and am having trouble listing lost
I'm amazed that I'm having trouble finding this, but does anyone have a listing
After adding the rspec test provided in Listing 7.32 rspec is having trouble returning
Having trouble with each function... Will try to explain by example... In my code,

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.