Проще всего, если мы пойдем на несколько другую схему именования выходных файлов. Это преобразует filename.pdf
в filename.pdf-compress.pdf
:
find . -name '*.pdf' -exec convert -density 200x200 -quality 60 -compress jpeg {} {}-compress.pdf ';'
Если вы хотите сохранить оригинальную схему именования, используйте:
find . -name '*.pdf' -exec env f={} bash -c 'convert -density 200x200 -quality 60 -compress jpeg "$f" ${f%.pdf}_compress.pdf' ';'
Make sure you are using rsync -z
to compress over the network.
Other options to consider are -H
(hardlinks) and -S
(sparse files).
Before you run your rsync, do a version with -nv
which does no
updates but shows you which files will be updated.
Out of the list of files, use your knowledge to match where a missing file might already exist on the remote, and then login to the remote and copy these files first.
For example, -nv
might show updates needed for:
ALLLibs/LibA/LibA.2
ALLLibs/LibA/LibA.2/file1
but if you know it is probably a copy of ../LibA.1/file1
, then
write a script to create and populate LibA.2 from LibA.1, and
run it on the remote. It can be as simple as cp -rp
. When you
do the real rsync, similar files will already be there, and changed
files will be updated. You will need --delete
to remove files
that should not be there (be careful with this option: test with -n
first).
Be careful in your copy command on the remote: copying a file usually sets
a new timestamp on the new file. rsync by default compares size and timestamp.
If they differ, the file will be updated. Use rsync option -c
to instead
checksum each file to see if it differs.