Turn commands into shell script

Hey. I want to do this repetitive task and I'd like to write a shell script to do it. The commands that I want the machine to repeat look like this:
cd /srv/web-data/conferences
pwd
ls -al >> /srv/web-data/work.txt
cd /srv/web-data/conferences/gurt99
pwd
ls -al >> /srv/web-data/conferences/gurt99
And the machine I'm working on tells me this about itself:
System = SunOS
Node = gusun
Release = 5.8
KernelID = Generic_108528-10
Machine = sun4u
BusType =
Serial =
Users =
OEM# = 0
Origin# = 1
NumCPU = 5
What do I have to do to turn a text file with a list of commands like the above into a shell script?
Thanks, Rebecca

Kai,
Here are 3 function you can use in shell script for executing a statement, sqlfile and procedure
function execStmt {
  typeset stmt=$4
  echo "
    set feedback off
    set verify off
    set heading off
    set pagesize 0
    whenever sqlerror exit 1
    whenever oserror exit 2
    $stmt;
    commit;
    exit 0
  " |  sqlplus -s  $1/$2@$3
  ret=$?
  if [ $ret -ne 0 ]
   then
      return 1;
   else
      return 0;
   fi
function execSql {
  typeset sqlfile=$1
  if [ ! -f $sqlfile ]
  then
       echo
       echo "File containing extract count doesn't exist...." 
       echo "Exiting ..."
       echo
       exit 1;
  fi
  echo "
    set feedback off
    set verify off
    set heading off
    set pagesize 0
    whenever sqlerror exit 1
    whenever oserror exit 2
    @$sqlfile;
    exit 0
  " |  sqlplus -s  $2/$3@$4
  retcode=$?
  if [ $retcode -ne 0 ]
  then
       return 1;
  else
       return 0;
  fi
function execPkg {
   echo "
   set feedback off
   set verify off
   set heading off
   set pagesize 0
   whenever sqlerror exit 1
   whenever oserror exit 2
   exec mypkg.procedure_name($4,$5); -- $4,$5 are argument list
    exit
  " |  sqlplus -s  $1/$2@$3
  ret=$?
  if [ $ret -ne 0 ]
  then
       return 1;
  else
       return 0;
  fi
}Regards

Similar Messages

  • Update command in Shell script

    Hi friends
    sqlplus -s / <<END
    set feedback on;
    update tran2 set sno=1;
    exit;
    END
    when i am using update command in shell script like above
    it is updating the database well...but i just want to know how many rows it is updating and i dont want to commit
    for that
    sqlplus -s / <<END
    set feedback on;
    update tran2 set sno=1;
    set feedback off;
    rollback;
    exit;
    END
    It's working fine
    is there any other method to do the same

    Well what's exactly your requirement? The current requirement doesn't make a lot of sense.
    How many row is going to be updated depends on where clause, if you have no where clause that essentially updating whole table, the number of row updated is count of your rows.

  • How to call a HP-UX command or shell script from Forms 4.5

    Does anybody know how to call a unix command or shell script to get a files list of HP-UX server from Oracle Forms 4.5 on client side? I tried to use DBMS_PIPE package to get it done but I failed. Please let me have the solution if anybody knows how. Very urgent!

    I tried the host command before and it just let me shell to the DOS environment but not HP-UX environment as Forms was running on Windows platform. So, I could not run a unix command or a shell script. Is DBMS_PIPE the only way to get it done?

  • Output format of sqlplus commands under shell script

    hi experts
    Can you help with some problems please?
    1.) I try to run shell script from dbms_scheduler, which runs sqlplus and the output of sqlplus commands is written to file using command spool. To this point everything is running ok.
    My problem is, that output of this file is: (e.g.)
    SQL> PROMPT ****************USERB******************
    ****************USERB******************
    SQL> --SELECT sid
    SQL> -- FROM v
    SQL> -- WHERE audsid = SYS_CONTEXT('userenv','sessionid');
    But I don't want the whole first line in the output file. I only want the output of this command, like on the second line.
    2.) How Can I write two outputs from sqlplus using command spool running at the same time into one file?
    Like in first issue described above. The main sqlplus create a job and this execute the background sqlplus using shell script. But both, the main and the background sqlplus are written to output file at the same time. But only one is written into. But I want the both outputs in the file.
    How Can I do that, if I can?
    Thanks a lot.

    user9357436 wrote:
    hi experts
    Can you help with some problems please?
    1.) I try to run shell script from dbms_scheduler, which runs sqlplus and the output of sqlplus commands is written to file using command spool. To this point everything is running ok. then why are you here?
    My problem is, that output of this file is: (e.g.)
    SQL> PROMPT ****************USERB******************
    ****************USERB******************so remove PROMPT line from the file
    >
    SQL> --SELECT sid
    SQL> -- FROM v
    SQL> -- WHERE audsid = SYS_CONTEXT('userenv','sessionid');
    But I don't want the whole first line in the output file. I only want the output of this command, like on the second line.
    2.) How Can I write two outputs from sqlplus using command spool running at the same time into one file?you can not do so.
    Like in first issue described above. The main sqlplus create a job and this execute the background sqlplus using shell script. But both, the main and the background sqlplus are written to output file at the same time. But only one is written into. But I want the both outputs in the file.
    How Can I do that, if I can?Can't.
    Now what?
    >
    Thanks a lot.Why using DBMS_SCHEDULER to invoke OS script to run sqlplus that runs SQL statements?
    this is like making THREE Left Turns, instead of single Right Turn.
    Just invoke PL/SQL procedure that does what needs to be done.

  • Stored Proc Execution through OS command using shell script

    Hi All,
    I have a requirement of executing one stored procedure before putting data in Table through JDBC adaptor and two stored procedures after that.
    I was thinking to write a shell script and execute it before and after message processing in adaptor.
    Can anybody please tell me how should i write a shell script for it?
    I have identified that exec <Stored_Proc_Name> is the syntax for it.
    Will i need to write something more in this script?
    Thanks,
    Atul

    Hi Atul,
    Stored procedures are written on the Database server for which you are going to write JDBC adapter.
    you will just call the storedprocedure in to your adapter.
    as per your requirement you shd run one stored procedure (let us say SP1) and then you have to push data into tables and then run SP2 and SP3...
    so for this write three stored procedures and call them into another SP. in this SP you call SP1 first then insert statement to insert data into tables and then SP2 and SP3.
    finally call SP into your JDBC adapter.
    you can call SP1 in SP as below
    Var_SQL :='call SP1 (''' || Var_1 || ''',''' || Var_2 ||''')' ;
    EXECUTE IMMEDIATE Var_SQL;
    i think for this shell script is not required.. correct me if i am wrong...
    Regards,
    Sukarna.

  • FTP command in shell script

    Hello All,
    I would like to transfer a file from one system to another system.
    so i haven written shell script with ftp command as follows.
    ftp -i 10.14.12.1<< END
    cd C:\Temp
    put $datafile
    ascii
    quit
    But i am getting error.
    Please let me know the sysntax followed by me is correct or thar remote system is down,
    Many thanks,
    Kumar.

    The ftp(1) command is not well-suited for scripting. Instead us the curl(1) tool:
    curl -T myfile ftp://ftp.some.where/down/in/this/dir/
    for example.
    $ man 1 curl
    for more details.

  • My first foray into shell scripting: tomcatctl

    I've written a tomcatctl script (a script for controlling Tomcat, loosely based on all those other somethingctl scripts for controlling things, like apachectl).
    It does start, stop, restart, status and version. It seems to work okay on my MacBook Pro, however, on my old, creaky G4 server, there seems to be a problem with restart. Apparently it tries to restart Tomcat before it has completely quit, leaving Tomcat in a weird, undead, zombielike state where it appears to be running, writing zero k log files, and not responding to requests, and it stays this way until I reboot the machine.
    If anyone out there is brave enough to try it out, I'd like to get some feedback, especially from people with different configurations and people with a little shell scripting experience.
    I'm sure I've made every conceivable noob scripting mistake, and I can't assume any responsibility for any damage it might cause, although I didn't manage to destroy anything while I was writing it, and it even worked fairly well on a 7 1/2 year old machine, except for the issue noted above.
    Download: http://idisk.mac.com/dlivesay-Public/tomcatctl.zip
    Unzip and put it in your command path. Please read it first and understand before you run. There are some lines at the top that have to be commented out or removed before it will run. You will probably also need to configure at least the "$CATALINA_HOME" environment variable before it will work.
    Please, please, pleeeease don't use this on a production server until it has been throughly tested on a similarly-configured machine!

    Joshua S wrote:
    What if you put in sleep between the stop and start (for restarting) so tomcat has time to shut down gracefully?
    That is not a very elegant solution. There is no way to know how long to wait. There should be some mechanism to determine when tomcat has successully shut down.
    Or, it could be a problem with the way you are starting tomcat. Follow the instructions in this thread to track it down.

  • Airport Command Line / Shell Script Tool

    Hi,
    Is there a way to issue a command to cause an Airport Extreme to reboot? I need to restart my airport extreme fairly often.
    Thanks,
    Bruce

    Hi,
    try OMBPlus.
    #Connect to repository:
    OMBCONNECT owbrep/passwd@mydesignhost:1521:mydesignrep USE REPOSITORY 'owbrep'
    #Export
    OMBEXPORT MDL_FILE 'C:\\file.mdl' FROM PROJECT 'MY_PROJECT' WITH DEPENDEE_DEPTH MAX INCLUDE_USER_DEFINITIONS OUTPUT LOG 'C:\\file.log'
    OMBDISCONNECT
    This export one project. If you want to export all projects, don't forget the project "PUBLIC_PROJECT", that contains all public stuff.
    Put this into a script and here you go.
    Checkout the OWB API and Scipting Guide for more options on OMBEXPORT.
    Regards,
    Carsten.

  • Commands in shell script

    Hai all,
    I need to write a script to add in the cron
         a) exec a procedure
    if successful ,then
         b) Truncate one schema table in the DB
         c) exec a procedure
    Can anyone let me know how to do this ? if anyone have any pointers, for the same , please let me know
    DB : 11.
    Os: Solaris 5.10
    Kai

    Kai,
    Here are 3 function you can use in shell script for executing a statement, sqlfile and procedure
    function execStmt {
      typeset stmt=$4
      echo "
        set feedback off
        set verify off
        set heading off
        set pagesize 0
        whenever sqlerror exit 1
        whenever oserror exit 2
        $stmt;
        commit;
        exit 0
      " |  sqlplus -s  $1/$2@$3
      ret=$?
      if [ $ret -ne 0 ]
       then
          return 1;
       else
          return 0;
       fi
    function execSql {
      typeset sqlfile=$1
      if [ ! -f $sqlfile ]
      then
           echo
           echo "File containing extract count doesn't exist...." 
           echo "Exiting ..."
           echo
           exit 1;
      fi
      echo "
        set feedback off
        set verify off
        set heading off
        set pagesize 0
        whenever sqlerror exit 1
        whenever oserror exit 2
        @$sqlfile;
        exit 0
      " |  sqlplus -s  $2/$3@$4
      retcode=$?
      if [ $retcode -ne 0 ]
      then
           return 1;
      else
           return 0;
      fi
    function execPkg {
       echo "
       set feedback off
       set verify off
       set heading off
       set pagesize 0
       whenever sqlerror exit 1
       whenever oserror exit 2
       exec mypkg.procedure_name($4,$5); -- $4,$5 are argument list
        exit
      " |  sqlplus -s  $1/$2@$3
      ret=$?
      if [ $ret -ne 0 ]
      then
           return 1;
      else
           return 0;
      fi
    }Regards

  • Issue passing variable into shell script

    Please see terminal session.
    -  calling pwd, unset, or echo alleviate the issue.
    - running the script 'plain' also exihibit an issue
    - calling 'cat test.sh' causes an issue
    I can repeat the issue on OSX 10.5.8
    On Ubuntu, two a's always print out with: A=a B=$A ./test.sh
    Terminal session:
    bash-3.2$ ls -l test.sh
    -rwxr-xr-x  1 axure  staff  16 Mar 29 09:27 test.sh
    bash-3.2$ cat test.sh
    echo $A
    echo $B
    bash-3.2$ pwd
    /Users/axure
    bash-3.2$ A=a B=$A ./test.sh
    a
    a
    bash-3.2$ A=a B=$A ./test.sh
    a
    bash-3.2$ $A
    bash-3.2$ $B
    bash-3.2$ echo $A
    bash-3.2$ echo $B
    bash-3.2$ unset
    bash-3.2$ A=a B=$A ./test.sh
    a
    a
    bash-3.2$ A=a B=$A ./test.sh
    a
    bash-3.2$ pwd
    /Users/axure
    bash-3.2$ A=a B=$A ./test.sh
    a
    a
    bash-3.2$ A=a B=$A ./test.sh
    a
    bash-3.2$ unset
    bash-3.2$ cat test.sh
    echo $A
    echo $B
    bash-3.2$ A=a B=$A ./test.sh
    a
    bash-3.2$ unset
    bash-3.2$ A=a B=$A ./test.sh
    a
    a
    bash-3.2$ A=a B=$A ./test.sh
    a
    bash-3.2$ unset
    bash-3.2$ ./test.sh
    bash-3.2$ A=a B=$A ./test.sh
    a
    bash-3.2$

    bash-3.2$ ls -l test.sh
    -rwxr-xr-x  1 axure  staff  16 Mar 29 09:27 test.sh
    bash-3.2$ cat test.sh
    echo $A
    echo $B
    bash-3.2$ pwd
    /Users/axure
    bash-3.2$ A=a B=$A ./test.sh
    a
    a
    As I would expect
    bash-3.2$ A=a B=$A ./test.sh
    a
    NOT what I would expect.  I tested this using bash 3.2 and got the same results, HOWEVER, when I tested this with bash 4.0, I got what I expected, namely your first results everytime.
    So I think there is a bug in bash 3.2.  You can get the bash sources, and build your own bash if you wish, or use a different method of setting 1 time envionment variables for use in a subprocess.
    bash-3.2$ $A
    bash-3.2$ $B
    bash-3.2$ echo $A
    bash-3.2$ echo $B
    As expected, as the way you set A & B were as 1 time environment variables that were only seen by the subprocess created when test.sh was run.  A & B were NOT created in the current shell environment, so the current shell environment would not have any values for A & B
    bash-3.2$ unset
    bash-3.2$ A=a B=$A ./test.sh
    a
    a
    bash-3.2$ A=a B=$A ./test.sh
    a
    Again, now what I would expect, but as I have already stated, I think there is a bug in bash 3.2 that does not exist in bash 4.0.
    Now a bigger question, why are you passing A & B as 1 time envionment variables?  Why not just pass them on the command line?
    test.sh a a
    where test.sh would be
    echo $1
    echo $2
    Or you could use export to create environment variables A & B
    export A=a
    export B=$A
    test.sh
    Now A & B would still exist after test.sh, which I assume you do not want to do.
    You could try ceating test.sh as a bash function and see if that changes the behavior
    test()
        echo $A
        echo $B
    A=a B=$A test
    You would have to define test() in your shell initialization scirpt if you needed each time you started a terminal session.
    While I have used 1 time environment variables, I more frequently just pass arguments on the command line.

  • Turn simple powershell into a script

    I have quite a few libraries that share the same column names and all need to be given default values.
    Rather than doing this by hand in the GUI I am turning to PS.
    I have few lines of PS (see below) and this works fine but I don't want to have to keep typing pasting so have decided I need to turn it into a script and pass three arguments to it so I can keep calling the script with different values.
    Can someone advise the correct syntax to transform these lines into UpdateColumns.ps1 and then how I would call it and pass threee arguments please.
    I have replaced the hard coded values with $VAR1, $VAR2 and $VAR3 to show what I need to use as arguments.
    $site = Get-SPWeb http://server/site/sub
    $list = $web.Lists[$VAR1]
    $Field = $List.Fields[$VAR2]
    $Field.DefaultValue = $VAR3
    $Field.Update()
    $List.Update()
    $web.Dispose()

    That error would be from one of these two lines:
    $list = $web.Lists[$var1]
    $Field = $List.Fields[$var2]
    So either you don't have a list named "comms" or a column named "function". The display name of the column and the "internal name" of the column may be different. To find the internal name go to the list's settings page, scroll down to the columns section
    and click the "function" column. Inspect the URL of that page looking for &Field= and use the name listed there.
    Mike Smith TechTrainingNotes.blogspot.com
    Books:
    SharePoint 2007 2010 Customization for the Site Owner,
    SharePoint 2010 Security for the Site Owner

  • Problems with executing shell script within oracle procedure

    I have procedure that's owned by Semantic user. This procedure calls job scheduler (owned by USER1) which in turn executes a shell script load_semantic.sh (owned by USER1).
    Now, there is a shell script(checkCount.sh)inside of this one (owned by this USER1) that has following contents:
    checkCount.sh
    #!/bin/bash
    MODEL=$1
    sqlplus -S user/pass << EOF
    whenever sqlerror exit 1;
    set echo on
    set verify off
    MERGE INTO SEMANTIC.COUNT_STATISTICS s
    USING (SELECT '$MODEL' AS MODEL, 0 AS NEW_COUNT, SYSDATE AS NEW_DATE, 0 AS OLD_COUNT, SYSDATE AS OLD_DATE FROM dual) t
    on (s.MODEL = t.MODEL)
    when not matched then
    INSERT (s.MODEL, s.NEW_COUNT, s.NEW_DATE, s.OLD_COUNT, s.OLD_DATE)
    VALUES (t.MODEL, t.NEW_COUNT, t.NEW_DATE, t.OLD_COUNT, t.OLD_DATE);
    COMMIT;
    UPDATE SEMANTIC.COUNT_STATISTICS SET  MODEL = '$MODEL', NEW_COUNT = (SELECT COUNT(*) FROM TABLE(SEM_MATCH('{?s ?p ?o}',SEM_Models('$MODEL'),NULL,SEM_ALIASES(SEM_ALIAS('','http://VISION/DataSource/SEMANTIC#')),NULL)) ),NEW_DATE  = SYSDATE,
    OLD_COUNT = NEW_COUNT, OLD_DATE  = NEW_DATE WHERE MODEL = '$MODEL' AND NEW_DATE = (select max(NEW_DATE) from SEMANTIC.COUNT_STATISTICS where MODEL = '$MODEL');
    COMMIT;
    exit;
    EOF
    So when I execute SEMANTIC.PROCEDURE:
    SEMANTIC.PROCEDURE => USER1.JOBSCHEDULER =>USER1.load_semantic.sh =>USER1.checkCount.sh
    It never populates the table SEMANTIC.COUNT_STATISTICS.
    I tried giving all of the permissions but I am probably missing something...
    Maybe fresh eyes can see something that I can't.

    I can't believe I am going to say this but the reason it was not working was because I removed oracle environment path from my script by mistake.
    . /etc/profile.d/oracle.sh
    Ugh...
    Now it is working perfectly.
    Btw, sqlplus does know about shell environment variables.
    THANK YOU GUYS!!! YOU ARE THE BEST!!!!!!!!!!!!!!!!!!
    I ONLY HAVE YOU TO TALK TO WHEN I AM STUCK ON A PROBLEM.

  • Hardcode password in a do shell script not working

    I have been trying to solve something i have wanted to do for a long time, that is get a script that changes the ammount of time before the display goes to sleep. I tried GUi scripting but in system preferences the changes made to the slider did not stay. So i have now come onto a do shell script. Found below. I would prefer to just hardcode my password into it however this does not seem to work. Any ideas ?
    set exitflag to false
    try
    repeat until exitflag is true
    set {text returned:Sleeptime, button returned:sleepstate} to (display dialog "Minutes before display sleep" & return & "Between 1 and 180 mintues" & return & "Greater than 180 means never sleep" default answer "1" buttons {"Cancel", "OK"} default button 2)
    set Sleeptime to Sleeptime as number
    if Sleeptime is less than 1 then
    set exitflag to false
    else if Sleeptime is greater than 180 then
    set Sleeptime to 0
    set exitflag to true
    else
    set exitflag to true
    end if
    end repeat
    end try
    set Sleeptime1 to Sleeptime as string
    set Sleeptime1 to quoted form of Sleeptime1
    set psswd to quoted form of "XXXXX"
    do shell script "sudo pmset -a displaysleep " & Sleeptime1 password psswd
    set pete to do shell script "sudo pmset -g"
    set xx to text -2 thru -1 of pete
    if xx - Sleeptime = 0 then
    tell application "SEC Helper"
    show screen message "Worked:" & return & xx & " mintues"
    end tell
    else
    tell application "SEC Helper"
    show screen message "Failed!"
    end tell
    end if

    1) don't use 'sudo' in a 'do shell script'. It isn't necessary and will sometimes break.
    2) do not use 'sudo' in a 'do shell script'
    3) do not use... I'm sure you get the idea.
    It is not necessary to use 'sudo' in a 'do shell script' command. 'do shell script' itself takes care of the authentication element when you use 'with administrator privileges'. Therefore the appropriate way of doing this is:
    <pre class=command>do shell script "pmset -g displaysleep " & sleeptime1 with administrator privileges password psswd</pre>
    If you omit the 'password psswd' element the user will be prompted to authenticate using the standard system authentication dialog.
    The problem you're running into is that the 'password' parameter is only valid when you use 'with adminitrator privileges', and is therefore getting ignored in your current script.

  • Shell Script - Sleep

    Hello All,
    We are printing pdf file outputs from shell script. Here we faced a problem that the shell script tried to access the output file(pdf file) while the concurrent program is running. For that we added the concurrent program names into shell script programs incompatibility list. This is working fine.
    But there are more than 20 reports using the same shell script. If all the programs are running shell script waits until all the 20 programs completed.
    I am thinking of another solution that, I have to issue a sleep command in shell script until the program completes, or until the output file is generated and the shell script can generate post script file from the output file.
    I dont know what kind of lock the concurrent program is using, because shell script says no such file or directory while generating post script file.
    Kindly help.

    You would probably find more concurrent manager experts in the Apps forums. You could try using the output of ps -ef to see if the program your script should wait for is still running. Or you can use the lsof command to see if the file you are supposed to process is still open in another process. For example, lsof -f -- /output/my.pdf shows all processes that have the file /output/my.pdf open.
    Edited by: herb on Jan 11, 2010 11:47 PM

  • Do shell script problem in Applescript

    Hi,
    I am an Applescript novice and have been trying to write a code to go to a particular folder, look for all files in the folder tree with extension .m2v and run an executable file to decode them. My problem is that when I run my code (containing do shell script), it searches through all files and folders on Mac HD and starts decoding .m2v files elsewhere that I don't want.
    Eventually it runs out of space (.m2v file decoding takes a lot of space), because it is dumping all decoded .yuv files onto the HD.
    When I run the command on Terminal, it executes the decoding perfectly and stores the decoded files in the same folder.
    Please help me about what's going on.
    My code is something like:
    tell application "Finder"
    set DestinationFolder to "xxxxxx:xxxx:xxxx"
    set NumFolders to (get count of folders under Destination folder)
    repeat for SomeVar from 1 to NumFolders
    set FolderinQuestion to folder SomeVar of DestinationFolder
    -- Tried tell application "Terminal" here, but did not know --how to export the FolderinQuestion variable from Finder to --Terminal
    do shell script " \" cd \" & (POSIX path of (result as text));
    for file in `find $pwd \"*.mov\"`
    do
    /usr/local/bin/decode file
    done"
    end repeat
    end tell
    I would greatly appreciate some guidance.

    The root of the problem is that you're trying to quote the cd command for some reason:
    <pre class=command>do shell script " \" cd \" & (POSIX path of (result as text));
    ...</pre>
    In addition to that you're including the & (POSIX path of (result as text)) as part of the shell command whereas this should be OUTSIDE of the quotes in order to get evaluated
    If you work that through you'll end up with a shell command that looks like:
    <pre class=command>" cd " & (POSIX path of (result as text))</pre>
    If you try to run that in a terminal you'll get a cd : command not found error and that's why the rest of it appears to fail.
    The solution to that one is simple - just don't bother quoting the cd and put the POSIX path stuff outside of the quotes to get it evaluated at runtime:
    <pre class=command>do shell script "cd " & quoted form of POSIX path of (FolderInQuestion as text)) & ";
    # rest of shell commands here"</pre>
    Now, as for the rest of the script there are a few things I would change.
    First, unless you need to know the index, don't do:
    >repeat for SomeVar from 1 to NumFolders
    set FolderinQuestion to folder SomeVar of DestinationFolder
    the issue is that the number of folders to process may change during the script's execution (other processes may create or remove folders). This will, at best, cause some folders to be skipped and, at worst, cause the script to fail.
    If you're iterating through a list, the best option is to just:
    <pre class=command>repeat with FolderInQuestion in (folders of DestinationFolder)
    ...</pre>
    This automatically sets the iterator (in this case, FolderInQuestion, to the first item in the list and increments it for each iteration through the loop.
    Secondly, in your shell script itself, scrub the entire do/done loop. You're already using find, so have that do the hard work using the -exec switch:
    <pre class=command>find path -name "*.mov" -exec /usr/local/bin/decode {} \;</pre>
    In find's case, {} is substituted with the current file's path.
    Putting this together you'd get:
    <pre class=command>tell application "Finder"
    set DestinationFolder to "xxxxxx:xxxx:xxxx"
    repeat with folderInQuestion in (get folders of folder DestinationFolder)
    do shell script "cd " & quoted form of POSIX path of folderInQuestion & "; find . -name \"*.mov\" -exec /usr/bin/decode {} \\;"
    end repeat
    end tell</pre>
    Note that I've used 'quoted form of POSIX path' - this takes care of any shell-unsafe characters like spaces in the path name. I've also used \\; for the -exec switch - this is so that AppleScript passes the \ to the shell command rather than using it for its own escaping.
    But you're not done yet!
    There's still one fatal flaw in this process - and that is the fact that find by default, is recursive - it will walk through every directory that it finds.
    This means that if you start at the top folder and iterate through, find will find all .mov files and decode them. Your script then cd's to the first subdirectory and repeats the process - decoding all the .mov files in that directory and all its subdirectories even though they've ALREADY been decoded.
    The upshot is that you only need to run one loop starting at the top level. You don't need to iterate through all the subdirectories since find will do that for you.
    In addition to that, there might not be a need to use cd at all since the first argument to find is the directory to start searching in. Unless there's some reason that you need to start decode from the top level directory (e.g. is that where it saves the files?), you can drop the whole repeat loop altogether and just run with:
    <pre class=command>set startFolder to (choose folder)
    do shell script "find " & quoted form of posix path of startFolder & " -name \"*.mov\" -exec /usr/bin/decode {} \\;"</pre>
    That's the entire script - a radical compression of your original.

Maybe you are looking for

  • How to get some character as a field separator while in GUI_DOWNLOAD ?

    Hi Friends, I have to download data from an internal table to a text file. The field separator between the fields should be comms (,). So, after getting the data into internal table i'm calling the Function Module GUI_DOWNLOAD. Now using this functio

  • ITunes won't open after I updated to 8.0.1

    Hello, Here's a little background on what's been going with itunes before the recent problem. These past couple weeks I've tried to update my itunes to 8.0.1 through the Apple Software Update. It never worked and at the end of the process it would te

  • How do I embed pictures in e-mail?

    I need to imbed pictures into my e-mail instead of attaching them. My daughter is in the navy and can not get attachments. I have tried copy and paste but unless I do that from an e-mail sent to me it doesn't work. == This happened == Every time Fire

  • I have my registration number for Photoshop Elements 6 and a dead computer

    I cannot locate where I can download elements 6.  I have my registration number, and I bought the product only 4 years ago.  I was happy with it, and I'd like to continue to use it.  Can anyone give me a tip on how to find and reload this? Thanks,  M

  • Play Count Wrong

    Reset my play count on iTunes 11.4, after listening to a couple songs, played once each and syncing iPhone to iTunes, play count says those songs have been played nearly 10 times each. Why is iTunes multiplying my play counts and how can I fix this?