Page 1 of 1

Need help with simple script for OS X

Posted: May 15th, 2011, 2:25 am
by Crush
Hello! I am looking to make a simple script for OS X to move all files out of a folder and into a different folder.

For example: Say I download something, it finishes and it unpacks to a directory called "Ubuntu 11 04." Inside of this folder, is the actual burnable image file. I want to move that burnable image file to the Desktop and then delete the folder "Ubuntu 11 04." How do I go about doing this?

Any help is GREATLY appreciated!

Re: Need help with simple script for OS X

Posted: May 16th, 2011, 3:40 am
by Crush
Someone else helped me out on a different forum. Here is what I am currently using if anyone was interested.

Code: Select all

#!/bin/bash

DIR_DEST=${HOME}/Movies/
DIR_TRASH=${HOME}/.Trash/

mv -f "$1"/* $DIR_DEST && mv -fv "$1" $DIR_TRASH

Re: Need help with simple script for OS X

Posted: August 1st, 2011, 10:12 am
by imthenachoman
Did you figure it out?
Crush wrote:Hello! I am looking to make a simple script for OS X to move all files out of a folder and into a different folder.

For example: Say I download something, it finishes and it unpacks to a directory called "Ubuntu 11 04." Inside of this folder, is the actual burnable image file. I want to move that burnable image file to the Desktop and then delete the folder "Ubuntu 11 04." How do I go about doing this?

Any help is GREATLY appreciated!

Re: Need help with simple script for OS X

Posted: August 1st, 2011, 3:32 pm
by Crush
Yep. My 2nd post contains the code I currently use.

Edit: I see my wording was ambiguous in my 2nd post. The code in that post is what I was ultimately looking for.