Converting a .bat executable to Mac

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

2

2 Answers

 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.

#!/bin/sh
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 whatever.sh in terminal, copy this code in, press Control-X, and y to save it, run chmod +x whatever.sh to make it executable then do ./whatever.sh to run it.

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like