Solved

Custom Command creating multiple tar's or zip's

Posted on 2008-11-02
5
1,705 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
  • 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

Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

Join & Write a Comment

Requirements: root access via SSH, telnet, or other.. Alternately, access from the server administrator to run a counter-strike server, and the proper access rights to do so. Enough free disk space (and allowed to use this much, eg disk quota): 6…
Goal:  To set up a secure SSH server for your home computer to make it accessible anywhere AND to use it as a port forwarding proxy. Steps 1.  WinSSHD version 5 is free for personal use.  So download and install it.  You can download it from the…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

706 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now