FG

Bash script to perform an action on each subdirectory in a directory

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

Problem

Assuming I have a directory structure like I'd like to be able to pass 'Dir1' to a bash script and then perform an action on all of it's subdirectories (SubDir1, SubDir2, SubDir3). Thanks for your help!

Error Output

Dir1/
  SubDir1/
  SubDir2/
  SubDir3/

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: Bash script to perform an action on each subdirectory in a directory

Low Risk

Given it sounds like you're going to be running , the best way is probably: If you wanted to use , you should add , to avoid creating extra tar files. Also note that in , the name of the output file comes first (right after the ).

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment