T
T
Twelfth Doctor2017-08-11 16:00:03
linux
Twelfth Doctor, 2017-08-11 16:00:03

How can you organize database dumps into folders?

Hello!
All databases on the server are named prefix_name
How can I put a dump of each database in / prefix / prefix_name .sql.gz ?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
F
falsebyte, 2017-08-11
@verdex

Script in a hurry
#!/bin/bash
target=`echo $1 | cut -f1 -d'_'`
mkdir $target
mv "$target"_* ./$target/
In the directory with dumps, call the script, passing it the name of the dump as an argument
mover.sh prefix_name.sql.gz

T
TyzhSysAdmin, 2017-08-11
@POS_troi

In the script with which you make a backup, create a directory and put the backup in this directory.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question