Answer the question
In order to leave comments, you need to log in
How to script freenas (freebsd) with tar command?
I have folders in one directory, like 20160426 (year, month, day), I need to place the archives of all such folders in another directory. Each folder has its own archive of the form 20160426.tar.gz
Now I do this
with
handles
:
Is it somehow automated? There are other files and directories in the dir1 directory that do not need to be archived, only with dates.
Answer the question
In order to leave comments, you need to log in
Create a script that requires two arguments - what to pack and where to tarring.sh :
#!/usr/bin/env bash
echo Argument provided:$1 $2
echo CMD to execute: tar $2/${1##*/}.tar.gz ${1}
find /dir1 -type d -regextype posix-extended -regex '.*[0-9]{8}' -exec ./tarring.sh {} dir2 \;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question