G
G
Gring762015-10-22 11:50:24
Backup
Gring76, 2015-10-22 11:50:24

How to create archives according to the principle 1 archive -1 folder?

Hello !
Linux
There is a folder with a bunch of directories and a bunch of different files in there.
You need to create archives of each directory with the files that are in them.
Name archives by folder names.
I suspect that find should help,
but so far it doesn't work :-(

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Saboteur, 2015-10-22
@saboteur_kiev

find. -maxdepth 0 -type d -name "*" -exec tar cvfz {}.tgz {} \;
even more precisely
find ./* -maxdepth 0 -type d -exec tar cvfz {}.tgz {} \;

V
Vladimir Martyanov, 2015-10-22
@vilgeforce

The simplest python script will solve your problem. Recursive traversal of the directory, for each of the directories encountered - launching the archiver in the mode when only files are archived.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question