2

I'm new to the Mac OSX terminal and Unix in general. I wrote the batch file for windows where it works. I'd appreciate your help to do the same on Mac.

  1. I have a network folder, that contains a file original.ext
  2. I want to drag that file ($1) on a script (or a desktop icon)
  3. the script makes a copy of the file called temp.zip (same network folder)
  4. the script should then remove files from the archive (via 'zip -d')
  5. the script renames the modified temp.zip to the the original file name plus a prefix -> HD-original.ext

This is what i have so far, not sure if it works:

#!/bin/bash

cp "$1" temp.zip
zip -d temp.zip somefolder/*
mv temp.zip "HD-$1"

It seems I also need a '.desktop' file on the desktop that passes the drag&dropped file's path to the script (not sure if this works on Mac):

[Desktop Entry]
Name=Trim Archive
Exec=PATH_TO_SCRIPT_FILE %U
Type=Application
mael'
  • 1,926
  • 2
  • 10
  • 19
Caelan
  • 21
  • 3

0 Answers0