osx - Automator bash unix script, read input files to move if single file or detect if multiple archive and then move archive -


i have droplet made automator, moves files when drop them on application icon folder.

now script looks this:

for f in "$@"     cp "$f" "volumes/testdrive/testfolder/$(basename "$f")"  done 

i wondering if possible command detect if multiple files input script , archive them zip function , move same folder, , if single file dropped regular copy of file specified folder.

use conditional, (syntax might way off):

if [ $# > 1 ]  zip $@ > /path/to/location/foo.zip  # line might need researched  else cp $@ /path/to/location/`basename $@` fi 

you wouldn't want loop, because it'd go through rigmarole of creating zip archive each file in selection. if doing moving each one, sure, use loop, you're taking them , zipping them


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -