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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T17:49:07+00:00 2026-06-16T17:49:07+00:00

I want do delete all files with a specific extension (.xsl) whose names are

  • 0

I want do delete all files with a specific extension (.xsl) whose names are not contained in another file. That is, if I have a file like

a.xsl
b.xsl
c.xsl

And a directory structure like

./a.xsl
./d.xsl
./folder1/b.xsl
./folder1/folder2/c.xsl
./folder1/folder2/e.xsl

I want to be able to delete d.xsl and e.xsl, but not a.xsl, b.xsl, or c.xsl. Target shell is BASH.

  • 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-16T17:49:09+00:00Added an answer on June 16, 2026 at 5:49 pm

    Something like this (Not tested):

    for fn in $(find -type f -name '*.xsl')
    do
      echo ${fn##*/} | grep -vf file1 >/dev/null && rm $fn
    done
    

    where file1 is the file containing the list of file entries.

    ${fn##*/} This removes everything till the last slash giving the filename alone. This is grepped against the file and if not resent, deleted.

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

Sidebar

Related Questions

I want to delete all subdirectories and files from a directory, but not the
I want to delete all files with the extension .bak in a directory. How
I want to delete all files in a folder that are less than 200
I want to execute ANT delete target, so that I can delete all files
I want to delete all the files in the current directory which do not
I want to delete all files in a directory with a given name, except
I have a html document and I want to delete all the divs of
Is there a way I can delete all files from svn having a specific
I want to delete all files older than 9 days. Since filectime returns the
I am using TortoiseSVN on Windows. I want to delete all files from all

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.