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
Solved

Custom Command creating multiple tar's or zip's

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
File Server backup 7 70
Is MSDN subscription the answer? 4 68
Cannot install / add SQL database when installing MyCalls software 22 119
Problem to router 7 71
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…
More or less everybody in the IT market understands the basics of Networking, however when we start talking about Storage Networks, things get a bit dizzier, and this is where I would like to help.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

839 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