First list all the pdfs with
ls -x lec*.pdf
lecture01.pdf lecture02.pdf lecture03.pdf
lecture04.pdf lecture05.pdf lecture06.pdf
now merge directly with ghostscript :
gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=merged.pdf lecture01.pdf lecture02.pdf lecture03.pdf lecture04.pdf lecture05.pdf lecture06.pdf
In last I had just middle-click pasted the names from each line of ls output and not the entire output at once because it contains \r \n.