S
S
Sevastoporn2020-03-02 06:40:24
linux
Sevastoporn, 2020-03-02 06:40:24

How to archive a huge number of folders by month in Linux?

There are over 500,000 directories that need to be archived each month into a separate archive.
The name of the directories has nothing to do with the date, so files can only be sorted by creation date.
As I understand it, fing is unlikely to sort this out.
What sorting mechanism is better to use in order to transfer the output for archiving?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
P
pfg21, 2020-03-02
@pfg21

if you have an incremental / complementary backup, then take a backuper.
find can give you a list of files no older than one month. and you feed it to the archiver. you get a package of new/changed files for the last month.
or do you need something else?

G
Germanjon, 2020-03-02
@Germanjon

Why don't you sort it with find? It's easy to run in two stages: write all the files (more precisely, the paths to them and the name) into a separate txt-shnik or SQL. At the second stage, drive all the necessary files into the archive.
In general, I agree with Sergey Kuzmin , it is better to describe the task in more detail

M
mayton2019, 2020-03-02
@mayton2019

There is some inconsistency in the assignment. Inside one folder there can be files for different months. What to do in this case is unclear. In general, the author needs to detail the task so that the respondents can understand what is really needed. What should be the output.

S
Saboteur, 2020-03-03
@saboteur_kiev

Go through the folders, taking their modified date and, based on this date, throw the folder into the archive
something like

find /home -maxdepth 1 -mindepth 1 -type d -exec myscript.sh  {} \;

myscript.sh:
zip -m $(stat -c %y $1|cut -d " " -f 1) $1
ps didn't test for launch, test before launching for production

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question