Я нашел ваш вопрос:
используйте ffmpeg -i YOUR_MOVIE_FILES -sample_fmts
Вы получаете длинные данные.
Для получения разрешения необходимо использовать истинный grep
. в этих данных вы можете найти разрешение.
ffmpeg -i YOUR_MOVIE_FILES -sample_fmts | egrep blahblah
или используйте сценарий awk
.
No puedes usar rsync --delete
así. No tiene estado y no guarda ningún registro de qué archivos se han eliminado entre ejecuciones. El indicador --delete
simplemente indica a rsync
que elimine todos los archivos del destino que no existan en el origen.
Para implementar esta eliminación restringida, creo que necesita mantener su propio estado. Ni rsync
ni unison
pueden hacer esto por usted.
La siguiente no es una solución completa segura -de error; es un punto de partida. (Sin embargo, maneja archivos con nombres extraños -incluidos aquellos que contienen una nueva línea incrustada.)
Suponga dos directorios src
y dst
. (A los efectos del ejemplo, realmente no importa si dst
es local o remoto.)
# Find the current list of files (do this just once, to prep the cache)
( cd src && find. -type f -print0 ) | LC_ALL=C sort -z >.state.src
Cada vez que realicemos una copia de seguridad, ejecute el siguiente código
# Run the rsync to transfer files. "dst/" could be local
rsync -av src/ remote:dst/
# Determine the set of files to delete in "dst/"
( cd src && find. -type f -print0 ) | LC_ALL=C sort -z | tee.state.src.new |
LC_ALL=C comm -z - -13.state.src |
ssh remote 'while IFS= read -d "" -r f; do rm -f "dst/$f"; done'
# That seemed to work, so update the state cache
[[ 0 -eq $? ]] && mv -f.state.src.new.state.src
Si su versión decomm
(como la mía )es anterior a GNU coreutils 8.25 y no tiene el indicador -z
, puede usar esta solución alternativa:
# Find the current list of files (do this just once, to prep the cache)
( cd src && find. -type f -print0 ) | tr '\0\n' '\n\0' | LC_ALL=C sort >.state.src
Cada vez que realicemos una copia de seguridad, ejecute el siguiente código
# Run the rsync to transfer files. "dst/" could be local
rsync -av src/ remote:dst/
# Determine the set of files to delete in "dst/"
( cd src && find. -type f -print0 ) | tr '\0\n' '\n\0' | LC_ALL=C sort | tee.state.src.new |
LC_ALL=C comm -13 -.state.src |
tr '\0\n' '\n\0' |
ssh remote 'while IFS= read -d "" -r f; do rm -f "dst/$f"; done'
# That seemed to work, so update the state cache
[[ 0 -eq $? ]] && mv -f.state.src.new.state.src