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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T12:15:28+00:00 2026-05-31T12:15:28+00:00

I have this bash script here #!/bin/bash find /Users/ -name *.mov -o -name *.flv

  • 0

I have this bash script here

#!/bin/bash
find /Users/ -name "*.mov" -o -name "*.flv" -o -name "*.mp4" -o -name "*.avi" -o -name "*.wmv" -o -name "*.mpeg" -o -name "*.avi" -o -name "*.wmv" -o -name "*.f4v" -o -name "*.m4v" -o -name "*.mxf" -o -name "*.ts" -type f -mtime +7 -exec rm -rf {} \;

It finds all the files that are older than 7 days, and that works fine, but when I want it to remove the result set that I found it doesn’t delete any of the files. Is there something I’m doing wrong? This is on Mac OSX 10.6

Any help would be great. Thanks!

  • 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-31T12:15:29+00:00Added an answer on May 31, 2026 at 12:15 pm

    Instead, of -exec rm -rf {}\;, try the -delete option if it’s available on your version of the find command. This will show an error message after each failed attempt to delete. That might give you more information what’s going on.

    $ find . -name "*.foo" -type f -mtime +7 -delete
    find: -delete: unlink(./four.foo): Permission denied
    find: -delete: unlink(./one.foo): Permission denied
    find: -delete: unlink(./three.foo): Permission denied
    find: -delete: unlink(./two.foo): Permission denied
    

    Neither find is returning the actual exit code from the delete/rm command. You may want to do something like this:

    find . -name ... -type f -mtime +7 | while read file
    do
       if rm -fr $file
       then
          echo "Successfully deleted $file"
       else
          echo "Error deleting file: Exit code $?"
       fi
    done
    

    That might give you a better understanding of what’s going on.

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

Sidebar

Related Questions

For testing purposes I have this shell script #!/bin/bash echo $$ find / >/dev/null
I have a script that looks like this #!/bin/bash function something() { echo hello
I have a shell script script here as below: #!/bin/bash CPUSELECTION=1 386SX off \
I have pulled the Bash script from here , which checks the AVI file
I have this line in a useful Bash script that I haven't managed to
Let's imagine I have a bash script, where I call this: bash -c some_command
I have a bash script file which starts with a function definition, like this:
Here's a snippet of a bash script I'm writing to log CPU loads: #!/bin/bash
I have written (tried to) this small bash script for searching through a range
I have a bash script which calls another bash script, like so: #!/bin/bash echo

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.