Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need some help converting a .bat executable file that I run on our PC at my job so that it works on a mac. Before we upload tar files to our website we run this script which to the best of my knowledge simply unlocks all of the permissions to the tar and all the images within.

If someone could help me in "translating" it to run on my Mac that would be awesome! I was hoping I could set up something in Automator

Here's the code

del images5.tar

move images4.tar images5.tar

move images3.tar images4.tar

move images2.tar images3.tar

move images.tar images2.tar

cd ..

tar --mode=777 -rvf images.tar *.jpg

tar --mode=777 -rvf images.tar p

move images.tar ./tarpics

share|improve this question
Have you simply tried running the existing file on a Mac by chance? If it already works on a Unix/Linux computer because OS X is based on Unix it should work. This isn't a Windows .bat file. – Ramhound Jun 22 '12 at 17:10
@Ramhound It is. There's no del or move on OS X. It's only tar, and that's available for Windows as well. – Daniel Beck Jun 22 '12 at 17:16
  DOS/Windows     Unix
  del             rm
  move            mv
  cd              cd
  tar             tar

But do check the man pages (or tar --help) for tar on both systems for --mode and -r options. Probably OK if both are GNU tar.

share|improve this answer
rm images5.tar
mv images4.tar images5.tar
mv images3.tar images4.tar
mv images2.tar images3.tar
mv images.tar images2.tar
cd ..
tar --mode=777 -rvf images.tar *.jpg
tar --mode=777 -rvf images.tar p
mv images.tar ./tarpics

You probably want a shell script, as shell scripts are the UNIX equivalent for bat files.

Just do nano in terminal, copy this code in, press Control-X, and y to save it, run chmod +x to make it executable then do ./ to run it.

share|improve this answer
Don't forget the shebang. To make a proper shell script, add #!/bin/sh as the first line. – Gordon Davisson Jun 23 '12 at 4:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .