Modify shell script to work with other folders

i am trying to modify a shell script that sorts files in a course folder into sub folders by month. I have a shell script that works, but when i try to modify it for another course folder it quits working. can someone let me know what i am doing wrong?
the working shell script:
do shell script "
for f in \"$HOME/Desktop/DWI Annual Report/\"*
do if [ ! -d \"$f\" ]; then
x=\"${f%%.*}\"
i=$((${#x}-3))
if [ -d \"$HOME/Desktop/DWI monthly/${f:$i:3}\" ]; then
mv \"$f\" \"$HOME/Desktop/DWI monthly/${f:$i:3}\"
fi
fi
done"
the nonworking modified script:
do shell script "
for f in \"$HOME/Desktop/DOEP Annual Report/\"*
do
    if [ ! -d \"$f\" ]; then
        x=\"${f%%.*}\"
        i=$((${#x}-3))
        if [  -d \"$HOME/Desktop/DOEP monthly/${f:$i:3}\" ]; then
            mv \"$f\" \"$HOME/Desktop/DOEP monthly/${f:$i:3}\"
        fi
    fi
done"

ok here is the applescript that works.
property total_student : 1
tell application "Finder"
  set master_path to alias "Users:macbook:Desktop:DWI Annual Report:Annual Report.xlsx"
  set filesWithDWI to get every file of folder ((path to desktop folder) & "DWI Annual Report" as string) whose name contains "DWI"
  repeat with f in filesWithDWI
  my transfer_data(f, master_path)
  end repeat
end tell
on transfer_data(child_path, master_path)
  tell application "Microsoft Excel"
  set child_book to (open workbook workbook file name (child_path as string))
  set child_doc to worksheet 1 of child_book
  set master to worksheet "sheet 1" of (open workbook workbook file name (master_path as string))
  set num to 15 --All lists start at index 12 or later, I'm putting 10 to be safe
  set students to {}
  tell child_doc --grab values from child document
  repeat until (value of cell (("A" & num) as string)) is 1
  set num to num + 1
  end repeat
  repeat until (value of cell (("B" & num) as string)) is ""
  set end of students to {namevalue of cell (("B" & num) as string)), driver_idvalue of cell (("C" & num) as string)), DOBvalue of cell (("D" & num) as string)), Ref_Recvalue of cell (("I" & num) as string)), pre_testvalue of cell (("J" & num) as string)), post_testvalue of cell (("K" & num) as string)), cert_idvalue of cell (("L" & num) as string))}
set num to num + 1
  end repeat
  set startdate to range "C7"
  set classlocation to range "C11"
  set instructor to range "H7"
  end tell
  tell master
  set num to 7
  log (value of cell (("B" & num) as string))
  repeat until (value of cell (("B" & num) as string)) is ""
  set num to num + 1
  end repeat
  repeat with student in students
  set value of cell (("A" & num) as string) to total_student
  set value of cell (("B" & num) as string) to name of student
  set value of cell (("C" & num) as string) to driver_id of student
  set value of cell (("D" & num) as string) to DOB of student
  set value of cell (("H" & num) as string) to pre_test of student
  set value of cell (("I" & num) as string) to post_test of student
  set value of cell (("J" & num) as string) to cert_id of student
  set value of cell (("f" & num) as string) to startdate
  set value of cell (("E" & num) as string) to classlocation
  set value of cell (("G" & num) as string) to instructor
  set value of cell (("K" & num) as string) to Ref_Rec of student
  set num to num + 1
  set total_student to total_student + 1
  end repeat
  end tell
  save child_book
  close child_book
  save active workbook in master_path
  close active workbook
  end tell
end transfer_data
do shell script "
for f in \"$HOME/Desktop/DWI Annual Report/\"*
do
    if [ ! -d \"$f\" ]; then
        x=\"${f%%.*}\"
        i=$((${#x}-3))
        if [  -d \"$HOME/Desktop/DWI monthly/${f:$i:3}\" ]; then
            mv \"$f\" \"$HOME/Desktop/DWI monthly/${f:$i:3}\"
        fi
    fi
done"
It takes the class rosters and copies the information from the class roster to the annual report and then moves the file to the monthly  folder and files it in the appropriate months folder based on the last three letters of the file name.

Similar Messages

  • UDM and shell scripts and working with the ENVIRONMENT variable options

    In Userdefined metrics you have the ability to pass envronment variables.
    I was going to send
    DIR=/db/db05/oradata/ORCL/hot
    How to handle whats passed to the shell script?
    It passes $1 as {DIR=/db/db05/oradata/ORCL/hot}
    yes with the brackets. Here I figured it would simply set the DIR environment variable.
    Any cool tricks to work with this mess?
    Is it meant for perl scripts instead?
    Daryl.

    Ilmari Aalto wrote:
    Hi Darth,
    Thanks for your hint! Nevertheless I think it's something more profound, since there's no error etc. For example, should I have the path wrong I assume that OWB would return me some kind of an error when it doesn't find the .sh-file? Isn't there any log-file to see whether the command was executed? It seems like the execution of the User Defined element would be skipped altogether.
    Cheers,
    IlmariNo, if you don't give an absolute path OWB will not return any error, it just wont do anything at all...

  • [svn:osmf:] 13494: Update build script to work with Flex 4 SDK.

    Revision: 13494
    Revision: 13494
    Author:   [email protected]
    Date:     2010-01-13 20:30:13 -0800 (Wed, 13 Jan 2010)
    Log Message:
    Update build script to work with Flex 4 SDK.
    Modified Paths:
        osmf/branches/flex4/build/build.xml

    No, you don't need Flash Builder to use the Flex SDK. If you download the SDK and unzip it, you'll find a 'bin' directory that has the mxmlc compiler in it. You can compile Actionscript or MXML files using that.
    ./mxmlc MyFlexApp.mxml
    If you are building an AIR application, you will use amxmlc
    ./amxmlc MyAIRFlexApp.mxml
    Then, launch your AIR application using adl
    ./adl.exe MyAIRFlexApp-app.xml
    Hope this helps,
    Joan

  • How to get this script to work with different browser

    Do you guys know how to get this script to work with mozilla firefox? 
    do shell script "open -a safari 'https://login.binck.nl/klanten/Login.aspx?ReturnUrl=%2fklanten%2fdefault.aspx'"
    tell application "Safari"
      activate
              tell document 1
                        repeat until ((do JavaScript "location.host") is "login.binck.nl")
                                  delay 1
                        end repeat
      do JavaScript"document.getElementById('ctl00_Content_Gebruikersnaam').value='sim';document.ge tElementById('ctl00_Content_Wachtwoord').value='password';window.open(document. g etElementById('ctl00_Content_LoginButton').href, '_self', 'true');"
              end tell
    end tell
    Thank you so much in advance:)

    That isn't possible. Firefox's AppleScript dictionary doesn't contain anything which can be used to manage JavaScripts.
    (63741)

  • Firefox crashing AND the scroll feature on my PC finger pad works with other browsers, but doesn't work on Firefox, which just happened since I updated. FRUSTRATING!

    Since I updated, Firefox is crashing daily. The finger scroll feature on my PC works with other browsers, but doesn't work on Firefox. It is also very, very slow, but other browsers aren't. I can't use it anymore until it's fixed.

    To open the <i>about:config</i> page, type <b>about:config</b> in the location (address) bar and press the "<i>Enter</i>" key, just like you type the url of a website to open a website.<br />
    If you see a warning then you can confirm that you want to access that page.<br />
    *Use the Filter bar at to top of the about:config page to locate a preference more easily.
    *Preferences that have been modified show as bold (user set).
    *Preferences can be reset to the default via the right-click context menu if they are user set
    *Preferences can be changed via the right-click context menu: Modify (String or Integer) or Toggle (Boolean)
    *http://kb.mozillazine.org/about:config

  • Game center wont recognise my apple ID but works with other accounts? On mountain Lion?

    Game center wont recognise my apple ID but works with other accounts? On mountain Lion? i tryed to test out the new game center on mountain lion and it will not let me log in no message pops up or forgot your password but when i try other accounts it works fine help please i really want to use game center for mountian lion!

    Game center wont recognise my apple ID but works with other accounts? On mountain Lion? i tryed to test out the new game center on mountain lion and it will not let me log in no message pops up or forgot your password but when i try other accounts it works fine help please i really want to use game center for mountian lion!

  • HT1688 My iphone 5 won't charge and it's in perfect condition, I dont drop it and it's not cracked. I tried multiple chargers, none of them are damaged and my outlets work with other things so the problem is my phone. What's wrong with it and what should

    My iphone 5 won't charge and it's in perfect condition, I dont drop it and it's not cracked. I tried multiple chargers, none of them are damaged and my outlets work with other things so the problem is my phone. What's wrong with it and what should I do? Please help me I need my phone for work.

    Make sure there's nothing blocking a contact in the charging port of the phone.

  • ISight not working with other apps

    I've currently been having a problem with my Intel iMac (specs in signature) since the iSight works with iChat (the green light turns on and everything), but it doesn't work with other apps such Delicious Library or Photo Booth. I also have a Windows XP partition on here, and it works just fine.
    With Photo Booth, I just get a green screen and no message. On Delicious Library I get a white screen and no message either. I've tried deleting the .plist file for Photo Booth, but that hasn't worked. Any ideas on how to fix this issue?

    If nothing above solves your problem, try all relevant suggestions from http://docs.info.apple.com/article.html?artnum=93240
    If the problem continues, you may have a hardware or software conflict. Some users report that plug-ins installed by Delicious Library cause conflicts with iSight.
    If your problem remains after trying all relevant Troubleshooting suggestions, uninstall D/L (or at least remove any QuickTime plug-ins D/L installs) to see if your system has a D/L conflict.

  • How to work with others in a same workspace (I mean collaboration)?

    I need to work with others in a same workspace.
    Is there any mechanism support collaboration in JDeveploper?
    Many thanks.
    Ben

    You can use a version management software to do this.
    JDeveloper has excellent support for CVS which is a free version management tool.
    You need to install CVS on a server that will provide access to all the users and then you can check-in your workspace and others can check it out.
    In addition you can download extensions to JDeveloper that support Subversion, Clearcase, Perforce, and Serena Dimension as version management software.
    For a basic introduction to working in teams with JDeveloper and a CVS repository see:
    http://www.oracle.com/technology/products/jdev/viewlets/1013/cvs_viewlet_swf.html

  • My imessage has just stopped working with one of my contacts, on both of our phones imessage still works with other contacts. Why can we imessage others but not each other?

    My imessage has just stopped working with one of my contacts, on both of our phones imessage still works with other contacts. Why can we imessage others but not each other?

    Yes... to no avail

  • FM Transmitter used to work fine but stopped working, bought 2 new ones and neither work, they work with other Ipods in the house, IPOD Usb syncs fine with Computer, why won't it work with the FM transmitters anymore?

    FM Transmitter used to work fine but stopped working, bought 2 new ones and neither work, they work with other Ipods in the house, IPOD Usb syncs fine with Computer, why won't it work with the FM transmitters anymore?

    Are the other iPods models, same version as yours. The 2 New FM Tx may need a new iPod software, which you can update via iTunes.
    Good Luck!

  • Hi im staying in UAE, why doesnt my interactive notification work with other apps like facebook?

    why doesnt my interactive notification work with other apps like facebook?
    its only working with the message app notifications.

    Sounds like the iPhone is carrier locked with Vodafone and if so, it can't be used with another carrier's SIM card.
    If so, only Vodafone can officially unlock the iPhone or send the unlock request to Apple.

  • Photoshop Elements 12 no longer see's my scanner.  So I cannot scan my pictures, help.  Windows 8.1 with HP Officejet 6500A Plus printer.  Scanner works with other programs in my PC.  Problem is PS12

    So I cannot scan my pictures, help.  Windows 8.1 with HP Officejet 6500A Plus printer.  Scanner works with other programs in my PC.  Problem is PS12

    I bought the Officejet 6500A Plus about one month and have experienced the very same problem. I tried to remedy this problem following suggestions in a number of different posts (static IP, router, firewalls etc), all to no avail. Last week I called support. The support I received by the tech over several hours and different days for a week was very good. However none of his suggestions corrected the connection issue. After today's recommended fix failed, he advised HP is aware of this issue with the 6500 and other affected printers. He claimed HP was working on a firmware upgrade. He did not know when the update would be provided. The tech also claimed HP acknowledged this problem in a written announcement. He agreed to email the announcement to me. I haven't received it. This has been the only problem I've had with the 6500

  • Getting rm-1500 that came with audigy4 to work with other applicati

    Hello all
    I've done a search and not come up with much, well that was helpful or recent so thought i'd post.
    I have an Audigy 4 sound card (can't see any other names so it's not a pro or platinum or anything else - just a bog standard audigy 4)
    it's an internal card and came with a usb ir receiver and rm-500 remote control. I installed the software off the cd and then i have installed the latest drivers from the website and also the mediasource software from the website (i hadn't installed the mediasource software from the cd!)
    The remote works ok in the creative entertainment centre - but how can you use it with other programs?
    Looking at other posts, i checked in the entertainment centre and made sure i had the 'enable remote control' 'enable remote control when windows starts up' 'enable control of windows applications' all ticked.
    I don't have any section where i can 'add' applications.
    I've also heard mention of a settings area in the mediasource program, i have version 5.0.38- been in there and i don't have a remote control tab or a remote and OSD tab - no other settings for the remote control.
    So is it possible to get the remote to control other applications - i'm thinking windows media player , media player classic, a latest version of poweerdvd or windvd, VLC, and maybe itunes.
    Is there anything i can do? Even if it involves a lot of manual working? I've seen some 3rd party remote software but they don't seem to work with the creative usb receivers.
    At the moment the power button turns the creative entertainment centre on and off as does the start button.
    Ideally i'd like to be able to open and close other programs with the remote control as well as pause/play/forward/etc - not sure if this is possible though.
    At the moment i'm going through this thread but not sure if it applies to my remote control
    http://tinyurl.com/24kknj
    I should also add that i have a directory at
    C:\Program Files\Creative\SBAudigy4\Entertainment Center\KeyMap
    which has files called windvd, powerdvd, wmpapp, winamp - so it looks like it should be able to get them to work, maybe with just a bit of modification - as i said before it would be good if i could open and close a media or dvd player with a remote key as well as controlling the program.
    one other thing - and i'm not sure if i imagined it LOL, but when i tried the remote a year or so ago (i think maybe with just the drivers installed and no other software)
    i'm sure the power button on the remote turned my pc off (with no configuration on my part) and maybe even on.
    Could it really do this?

    i've discovered that pressing the cancel button closes apps and once everything is closed pressing it brings up the shutdown pc pop up where you can then select turn off, restart etc - so i can use it to turn the pc off.
    Still having probs getting it to work with other apps though - strange as i have the key files for various apps but other people seem to have a setting in mediasource where they can 'ADD' an app by browsing for the exectable - i don't have the remote settings page in my mediasource (latest version) for some reason.
    Can anybody help?

  • Can Oracle APEX work with other databases?

    Can Oracle APEX work with other databases like Microsoft SQL Server or Sybase... etc.?

    Though, the Generic Connectivity does not cost extra.
    It doesn't have all the features of Transparent Gateway, but if you can access the foreign database with an ODBC driver,
    it's an easy way to integrate multiple databases.
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14232/gencon.htm#HETER007
    In one application, I pull data into materialized views from MS Access and Lotus Notes.
    Since Apex lives in an Oracle database, it inherits all of the functionality of Oracle.
    There's not much it can't do.

Maybe you are looking for

  • HELP. Where is my registration code?

    I just bought Quicktime Pro and received the confirmation e-mail. No where in the e-mail does it list my registration code. I can see an ORDER NUMBER, a PRODUCT NUMBER, and even a PURCHASE ORDER NUMBER. The e-mail mentions 'To get started, enter your

  • DPP Digital Photo Professional and Flickr

    hi there... on begin i want t osay sorry for my not  precise speling.. im DPP user and lover...i was think of  come to this forum long ago but like it happend i was late so im now .. ok ..my point its DPP Software... on Flickr there is Group where pe

  • Lose connection to magic mousse

    Hello, I buy my first Apple computer (IMac 21,5) 4 month ago. I was very excited !! But now a little disapointed with problem for connecting my magic mousse to the computer. I try a lot of things, but nothing seems to resolve this problem. I restart

  • How to stop Safari from realoading page and worst, start at the TOP?

    When clicking something, for example an article in an online newspaper, after reading, when you scroll back to the newspaper, Safari reloads and starts at the TOP of the page. This drives me crazy, and I have to work hard to figure out were I was in

  • Can the AQ Adapter send a JMS Message?

    I'm trying to use the AQ adapter to enqueue an XML message into a queue who's payload type is AQ$JMS_TEXT_MESSAGE so that it can be consumed by a Message Driven Bean in OC4J. Simply sending the XML reults in: "AQ Adapter: ** Error ** Can not enqueue