Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Custom tar script to traverse directories and creat individual tarballs? **Help**

Avatar of eunit3130
eunit3130 asked on
Linux OS DevServer SoftwareAlgorithms
10 Comments1 Solution1057 ViewsLast Modified:
So i have directive listed

 ls -la
total 44
drwxr-xr-x 10 root       root       4096 May  6 12:32 .
drwxr-xr-x 22 root       root       4096 Apr 15 11:03 ..
drwxr-xr-x 13 root       root       4096 Jan  9 12:38 adodb
drwxr-xr-x  2 root       root       4096 Nov 12 10:44 cgi-bin
drwxr-xr-x  3 root       root       4096 Jan  8 14:07 error
drwxr-xr-x  2 root       root       4096 Apr  6 13:39 html
drwxr-xr-x  3 root       root       4096 Jan  8 14:09 icons
drwxrw-r--  5 virtualftp virtualftp 4096 May  5 12:40 iWatch
drwxr-x---  4 virtualftp virtualftp 4096 May  5 12:45 Marvel
drwxr-xr-x  2 root       root       4096 May  6 12:34 users

I want a tarball of each folder seperately like:


Would this work?

for dir in */
    do dir=`echo $dir | tr -d '/'`
    echo $dir
    tar czf $dir.tar.gz $dir

I've attempted this:

tar -czf -f !.tar.gz !
-bash: !.tar.gz: event not found

So please help me here im lost. I dont know perl that well. I understand the code and the logic. Just dont know
the syntax
Avatar of eunit3130

Our community of experts have been thoroughly vetted for their expertise and industry experience.

This problem has been solved!
Unlock 1 Answer and 10 Comments.
See Answers