bash - Problem copying images to backup directory - Ask Ubuntu


i have problem when need copy png , gif images in directory.

i have code:

#!/bin/bash  typea="png" typeb="gif"  read -p "say directoy" $directory  find ~/*.$typea -size +10000k -exec cp -r $directory {}\ find ~/*.$typeb -size +10000k -exec cp -r $directory {}\ 

the last 2 commands unterminated, , trying copy $directory files... surely not want. also, please quote variables...

i think looking files .gif , .png extensions in ~ on size, want copy directory... in case better ditch assignment of typea , typeb in script , do:

find ~ -iname "*.png" -size +10000k -exec cp -r '{}' "$directory"  \; find ~ -iname "*.gif" -size +10000k -exec cp -r '{}' "$directory" \; 

or better

find ~ -iname "*.png" -size +10000k -exec cp -r '{}' "$directory" + find ~ -iname "*.gif" -size +10000k -exec cp -r '{}' "$directory" + 

if expect lot of results.


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