По какой-то причине мой find -foo не был на должном уровне, поэтому я взломал один ответ stackexchange на замену find и придумал это.
#!/bin/bash
# mytime is the number of seconds of the mp3 that you want to delete,
# in this case 3 minutes
mytime=180
files="$(find -L "<put your top level directory here>" -type f -name "*.mp3")";
# are there any files at all?
if [[ "$files" == "" ]]; then
echo "No files";
return 0;
fi
echo "$files" | while read file; do
# take the file, find the time, convert to seconds
times="$(mp3info -p "%m:%s\n" "$file" |awk -F':' '{print ($1*60)+$2}')"
# if that is greater than 3*60, we delete the file, which is $file.
if [[ "$times" -lt "mytime" ]]
then
# WARNING, there be dragons here...
echo "We are removing $file from the system..."
rm "$file"
fi
done
Встроенный -вconvert
ImageMagick может работать с PDF-файлами:
convert -density 300 input.pdf -quality 30 output.pdf
К сожалению, quality
, кажется, не распознается при добавлении других аргументов, таких как threshold
, и не может сжимать PDF-файлы, созданные ImageMagick, например.:
convert -density 300 input.pdf -threshold 60% - | convert - -quality 30 output.pdf
не удается -он создает три копии каждой старой страницы на каждой новой странице.
Если вы знаете, как это обойти, сообщите мне.