Solved

Custom Command creating multiple tar's or zip's

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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

Suggested Solutions

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…
Introduction People like FTP.  It's a solid, stable, robust protocol for quickly transferring files between two hosts using TCP/IP.  In most cases it's much faster than SMB or CIFS, and certainly much easier to set up between organizations.  This…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…
A short film showing how OnPage and Connectwise integration works.

932 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

12 Experts available now in Live!

Get 1:1 Help Now