Answer the question
In order to leave comments, you need to log in
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
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?
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
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.
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 {} \;
zip -m $(stat -c %y $1|cut -d " " -f 1) $1
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question