October 20, 2010

Linux command line stuff

Finding number of files in a folder:
find . -type f | wc -l

Finding number of subfolders in a folder:
find . -type d | wc -l


All taken from here

Creating 1 pdf from multiple images:

cd FOLDER_WITH_IMAGES
FILES=$(ls *jpg)
mkdir temp && cd temp
for file in $FILES; do BASE=$(echo $file | sed 's/.jpg//g'); convert ../$BASE.jpg $BASE.pdf; done &&
pdftk *pdf cat output ../FINAL_NAME.pdf &&
cd ..
rm -rf temp

All taken from here

No comments: