FG

Bash Find Files with zero size and delete files with different extensions

Fresh3 days ago
Mar 15, 20269180 views
Confidence Score0%
0%

Problem

This command will find files of zero size: A filename returned might be I am looking for a one liner that will delete files found with this, plus any that have the same filename with a different extension (which would be non-zero sized), so these files would be deleted too:

Error Output

find . -size 0

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: Bash Find Files with zero size and delete files with different extensions

Low Risk

explanation: find all files with size 0 pipe the names to the while loop cut of the suffix (extension) part (read ) all other files with the same base

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment