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

  • Home
  • SEARCH
  • 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 8550251
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T13:54:33+00:00 2026-06-11T13:54:33+00:00

I have temp directories full of junk that all start with __temp__ (e.g. __temp__user_uploads

  • 0

I have temp directories full of junk that all start with __temp__ (e.g. __temp__user_uploads), which I want to delete with a cleanup function. My function attempt is to run:

find . -name __temp__* -exec rm -rf '{}' \;

If I run the command and there are multiple __temp__ directories (__temp__foo and __temp__bar), I get the output:

find: __temp__foo: unknown option

If I run the command and there is only 1 __temp__ directory (__temp__foo), it is deleted and I get the output:

find: ./__temp__foo: No such file or directory

Why doesn’t the command work, why is it inconsistent like that, and how can I fix it?

  • 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-11T13:54:35+00:00Added an answer on June 11, 2026 at 1:54 pm

    Use a depth-first search and quote (or escape) the shell metacharacter *:

    find . -depth -name '__temp__*' -exec rm -rf '{}' \;
    

    Explanation

    Without the -depth flag, your find command will remove matching filenames and then try to descend into the (now unlinked) directories. That’s the origin of the “No such file or directory” in your single __temp__ directory case.

    Without quoting or escaping the *, the shell will expand that pattern, matching several __temp__whatever filenames in the current working directory. This expansion will confuse find, which is expecting options rather than filenames at that point in its argument list.

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

Sidebar

Related Questions

I have temp table #xml that have 2 columns: CREATE TABLE #xml ( id
I have: $page_file_temp = $_SERVER[PHP_SELF]; which will output: /templates/somename/index.php I want to extract from
I have a python ndarray temp in some code I'm reading that suffers this:
I have several values in a temp table called #tempIQ and I want to
I have a SQL script that populates a temp column and then drops the
I have a DB that contains a list of paths to files. I want
So I have this temp table that has structure like: col1 col2 col3 col3
Let's say I have a temp table of data I want to put into
We have created one temp-table dynamically . and we want to out put the
I have a temp table that needs the values of a Stored procedure. So

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.