0

I have assignment directory containing folder for each student.
Each folder contains the studentname.tar.gz submission file.
I have 100 such submissions.
Assignment/
S1/s1.tar
S2/s2.tar
How do I untar them all with command line or script in the same folder as the student's ?

2

Something along the lines of

for D in Assignment/*; do
  test -d "$D" || continue
  tar -C "$D" -xf "$D/"$(basename "$D")".tar"
done

should do the trick.

If these are .tar.gz (and not .tar) files you will want -xzf

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.