D
D
Dima Kim2016-03-10 11:26:26
linux
Dima Kim, 2016-03-10 11:26:26

How can I archive and delete?

Good afternoon, there are 50,000 ~2MB files,
how can I create an archive and delete it right away, i.e. put it in the archive and immediately deleted the file, switched to the second file, etc.
Now I do this:
find . -mmin -3600 -type f | xargs tar -acvf bkp.tar.gz
find . -mmin -3600 -type f -delete

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Wolf, 2016-03-10
@mannaro

I wouldn't do that if I were you. If something happens, you will be left with a broken archive and without half of the files.

K
ky0, 2016-03-13
@ky0

Make several tar containers (say, a thousand files each) with the removal of the files placed in them, and then press the containers with gzip?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question