[[+content_image]]
V
V
Viktor Taran2022-04-06 15:26:48
bash
Viktor Taran, 2022-04-06 15:26:48

Why are all files sent and not just those that are needed?

We collect the files we need, they turned out to be 20
[[email protected] files]# cd /var/www/www-root/data/www/site.ru/files/ && find . -mtime -6 -print0
../220401114235_04f4b870634b82d0573813f8455b035c.pdf./220401101257_7cd665ddbb2e54a168b229baa7024f44.jpg./220331182053_Naydikvartiru_172x124_Nagatino.jpg./220401114235_5e7f47cf41fe09a065a8293c91b31c80.pdf./220401102418_e41cd2f1874d2ae04f849e11b0270457.jpg./220401121448_d7df237c165faf0d4c520d09507a17ec.pdf./220401162139_b82e913385efb8e9420090f7989d445a.pdf./220401162931_012c44f115a96134a2f91b8f6546ea57.pdf./220331182352_SF_Naydikvartiru_172x124-min.jpg./220401163051_6124a6870bf055425de9187ca0782a18.pdf./220331182734_7b6cc6f0dd8d954cb9f9e01e64183d9d.jpg./220401163157_b82d29b4df52f5effb9c15320706787a.pdf./220401163333_a60c6e6b36ce77a325ed59c1320891c9.pdf./220401163448_6b2cce22511df1ac0d2dac0aaf3296d0.pdf./220401121448_c059af1dc1b802e2d81f505d08624db9.pdf./220401115634_5bcf19b82444c1737d2b373560b38651.pdf./220401115634_9975f1baaf345339714edf4aefc89cdf.pdf./220401120428_c47970ee31506b0b745f0146a266cf95.pdf./220401120428_3ad1e56760d0606fbdce043b7e4fd569.pdf[[email protected] files]#


Actually we transfer them to the tar and tries to send them to the server we need
cd /var/www/www-root/data/www/site.ru/files/ && find . -mtime -6  -print | tar --null --files-from=/dev/stdin -cf - | ssh [email protected] tar -xf - -C /tmp/


They come, but the whole folder comes, not just these files
ls | wc -l
2303

Answer the question

In order to leave comments, you need to log in

[[+comments_count]] answer(s)
O
Oleg Volkov, 2022-04-06
@shambler81

find -type f

A
Alexander Karabanov, 2022-04-06
@karabanov

In a command that is just a search -print0in a command that packs -print, while y taris still specified --null
This is how it works:

find /var/www/www-root/data/www/site.ru/files/ -mtime -6 | tar -cf - -T - | ssh [email protected] tar -xf - -C /tmp/

But it's better to use-print0

S
Saboteur, 2022-04-07
@saboteur_kiev

why not:

scp $(find /var/www/www-root/data/www/site.ru/files/ -type f -mtime -6)  [email protected]:/tmp/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question