0
I’m trying to run the lowriter(generate PDF) loop, this way:
#!/bin/sh
ROOT_DIRECTORY="docs"
function count_files()
{
ls -lR $ROOT_DIRECTORY/*.doc | wc -l
}
function get_number_folders()
{
expr $(count_files) / 100 + 1
}
function create_folders_and_fill_with_files()
{
for num in $(seq 1 $(get_number_folders))
do
#mkdir $ROOT_DIRECTORY/$num
mv `ls $ROOT_DIRECTORY/*.doc | head -100` $ROOT_DIRECTORY/$num/
convert_to_pdf $ROOT_DIRECTORY $num
done
}
function convert_to_pdf()
{
lowriter -convert-to pdf --outdir ./docs/ $1/$2/*.doc --headless
set -x
}
create_folders_and_fill_with_files
Apparently the command is right, the only problem is that it runs 1 single time and stops, does not run again, as I can run the lowriter several times?
Grateful