Solved

Custom Command creating multiple tar's or zip's

Posted on 2008-11-02
5
1,711 Views
Last Modified: 2013-12-02
I am trying to find a custom command for WinSCP for creating multiple tar's or zip's.

On my server I have 100's of folders that contain images and files, what I would like to do is make a seperate tar or zip for each folder for easy downloading.

I can do this for each folder but this takes a long time doing each one seperately.

What I need is a command to take the folder name of each folder and make a tar or zip of that folder. So if I say select 50 folders it will make an individual zip or tar.

I can at the moment only make one archive of all the folders and can not find a way of making seperate archives for each folder.

The command for 1 archive is ( tar -cz  -f "!?&Archive Name:?archive.tgz!" !&)

Many thanks.
0
Comment
Question by:alanaldis
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 40

Expert Comment

by:omarfarid
ID: 22861218
you can run a remote loop like

for folder in /path/to/folder1 /path/to/forder2
do
   tar -czf /path/to/backup/$folder.tar.Z $folder
done
0
 

Author Comment

by:alanaldis
ID: 22861259
Sorry to say that does not work. I get an error (image attatched)

I need the tar's or zips to be created in same the location of the folders.

If I used this unrar command it creates and extracts to the current location (unrar x "!" "!?&Extract to directory:?.!")

Thanks.
error.jpg
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 22861287
note that you need to put the actual folders paths, what I gave was an example
0
 

Author Comment

by:alanaldis
ID: 22861388
Ok, Thanks.

But what I am trying to do is find a way so I don't need to do anything like that.

The command needs to be able to do it automatically if that is possible.

Very simular to the unrar command but in the opposite way.
0
 

Accepted Solution

by:
alanaldis earned 0 total points
ID: 22868373
Found the answer.

custom command is:

 tar -cz -f "!.tar" "!"

also check Apply to directories.
0

Featured Post

What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Samba is the de-facto standard program (or, more correctly: suite of programs) that UNIX and Linux systems use to share files with Microsoft Windows (and more recently, Mac OS-X) systems. Currently, there are 2 common versions of Samba available,…
Hyper-convergence systems have taken the IT world by storm and have quickly started to change our point of view of how the data center should and could be architected. In this article, I’ll explain the benefits of employing a hyper-converged system …
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question