Advertisement
Guest User

autoopen-full

a guest
Sep 29th, 2017
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.48 KB | None | 0 0
  1. setenv LOG /Users/<YOURUSERNAME>/Downloads/FolderActionLog.txt
  2. setenv OPENTHESE "pdf,png,jpg,jpeg,mp4,avi,mov,torrent"
  3.  
  4. echo "Evaluating the following files for opening on "`date` >> $LOG
  5. echo $* >> $LOG
  6.  
  7. #This assumes that all files submitted have absolute paths
  8. perl -e 'my @exts=split(",",shift(@ARGV));my $pat=join("|",@exts);my @fs=();foreach(@ARGV){if(m%^/%){push(@fs,$_)}else{$fs[-1].="\\ ".$_}}foreach(grep {/\.($pat)\z/i} @fs){system("open " . $_)}' $OPENTHESE $* >>& $LOG
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement