Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Post History

77%
+5 −0
Q&A Recursively remove files with the same name as the ones that end in `.part`

I want to remove all files with the ".part" extension in the current directory and its subdirectories, including files with the same name but different extension. Is this correct? find . -name '*...

3 answers  ·  posted 1y ago by ShadowsRanger‭  ·  last activity 10mo ago by jimbobmcgee‭

Question find remove
#4: Post edited by user avatar ShadowsRanger‭ · 2023-02-10T11:46:13Z (about 1 year ago)
  • Delete all files with the same name as the ones that end in `.part`
  • Recursively remove files with the same name as the ones that end in `.part`
  • I want to find all files under the current directory that end in `.part` and delete them, along with all files with the same name even the ones with different extension.
  • Is this correct?
  • ```
  • find . -name '*.part' -exec sh -c 'base="$(basename "$1" .part)"; find . -name "$base*" -delete' sh {} \;
  • ```
  • I want to remove all files with the ".part" extension in the current directory and its subdirectories, including files with the same name but different extension.
  • Is this correct?
  • ```
  • find . -name '*.part' -exec sh -c 'base="$(basename "$1" .part)"; find . -name "$base*" -delete' sh {} \;
  • ```
#3: Post edited by user avatar ShadowsRanger‭ · 2023-01-13T20:20:07Z (over 1 year ago)
  • I want to find all files under the current directory that end in `.part` and delete them, along with all files with the same name even the ones with different extension.
  • Is this correct?
  • > You can use the command `find` to search for files under the current directory that end in `.part` and delete them. The command to delete all files with the same name even the ones with different extension is
  • > ```
  • > find . -name '*.part' -exec sh -c 'base="$(basename "$1" .part)"; find . -name "$base*" -delete' sh {} \;
  • > ```
  • I want to find all files under the current directory that end in `.part` and delete them, along with all files with the same name even the ones with different extension.
  • Is this correct?
  • ```
  • find . -name '*.part' -exec sh -c 'base="$(basename "$1" .part)"; find . -name "$base*" -delete' sh {} \;
  • ```
#2: Post edited by user avatar ShadowsRanger‭ · 2023-01-13T20:19:09Z (over 1 year ago)
  • I want to find all files under the current directory that end in `.part` and delete them, along with all files with the same name even the ones with different extension.
  • Is this answer correct?
  • > You can use the command `find` to search for files under the current directory that end in `.part` and delete them. The command to delete all files with the same name even the ones with different extension is
  • > ```
  • > find . -name '*.part' -exec sh -c 'base="$(basename "$1" .part)"; find . -name "$base*" -delete' sh {} \;
  • > ```
  • I want to find all files under the current directory that end in `.part` and delete them, along with all files with the same name even the ones with different extension.
  • Is this correct?
  • > You can use the command `find` to search for files under the current directory that end in `.part` and delete them. The command to delete all files with the same name even the ones with different extension is
  • > ```
  • > find . -name '*.part' -exec sh -c 'base="$(basename "$1" .part)"; find . -name "$base*" -delete' sh {} \;
  • > ```
#1: Initial revision by user avatar ShadowsRanger‭ · 2023-01-13T20:18:33Z (over 1 year ago)
Delete all files with the same name as the ones that end in `.part`
I want to find all files under the current directory that end in `.part` and delete them, along with all files with the same name even the ones with different extension.

Is this answer correct?

 > You can use the command `find` to search for files under the current directory that end in `.part` and delete them. The command to delete all files with the same name even the ones with different extension is
> ```
> find . -name '*.part' -exec sh -c 'base="$(basename "$1" .part)"; find . -name "$base*" -delete' sh {} \;
> ```