command line - How to find resources for running a script Ubuntu server - Ask Ubuntu


if can point me direction of can learn more type of work appreciate it. have experience scripting php more , have been working on learning linux (ubuntu server cli via ssh , sftp moving files in , out of vm).

trying batch process multiple images in multiple directories. using imagemagick, works on 1 file @ time.

i'd run starting @ top directory , job jpg files script can find.

pseudo code -

for folders in directory   open folder   check if folder "drawings" (if !exists) {start loop over} else :     open drawings folder     each file in drawings       if file jpg         run program on (convert image.jpg -crop 713x470+5+3 output.jpg) 

figured out had loop-wise, needed hang of loop syntax. hope helps else out might need loop through sub-directory based on it's name.

for dir in */     subdir in $pwd/"$dir"*/             if [ "$subdir" == $pwd/"$dir""drawings"*/ ]                     file in "$subdir"*.jpg                             rm "$file"             done              file in "$subdir"*.pdf                             newname="${file/.pdf/}"                 convert -density 200 "$file" -append -resize 850 -background white -flatten "$newname".jpg             done              file in "$subdir"*.jpg                             newname="${file/.jpg/}"                 if [[ "$file" == *"insulation"* ]]                                     convert "$file" -crop 820x710+15+97 "$newname-cropped.jpg"                 else                     convert "$file" -crop 820x870+15+79 "$newname-cropped.jpg"                 fi             done         fi     done done exit 0 

Comments

Popular posts from this blog

download - Firefox cannot save files (most of the time), how to solve? - Super User

windows - "-2146893807 NTE_NOT_FOUND" when repair certificate store - Super User