Question about simple script?

Hello,
I would like to write a small program/script and am looking for advice on how to do so. I do not have a preference about which method or language to use, hopefully looking for the simplest way to do this (if it works with Windows or DOS command line this is
preferable).
I have a program that runs on text files e.g. "program file1.txt file2.txt"
I have 20 folders that each have 5-10 text files. I want to automatically get the name of the largest size text file from each of the 20 folders, and then run the program on these 20 files as described above.
Ideally I could point my script to a folder, and it will automatically find the largest .txt file in each of the subdirectories and run "program file1.txt file2.txt file3.txt ..."
Any ideas on how to most efficiently accomplish this? Ideas or links to tutorials if applicable are helpful.
Thank you

Yes this is very helpful, thank you so much. I have a couple of questions:
What I am doing is actually running a perl wrapper that calls a java program, so my command looks something like this and it works fine if I enter multiple full path file names without quotes:
perl Program C:\Folder1\Subfolder1\file1.txt C:\Folder1\Subfolder2\file2.txt C:\Folder1\Subfolder3\file3.txt
The script as you described above does exactly what I am hoping for. For the $Path variable, I would like to either
1) have this script begin from the directory that is it run from so if I copied it to C:\Folder1\ then it would run the command as shown above, or
2) allow for a parameter to be passed to it with the path of the directory to begin from e.g. "powershellscript.ps C:\Folder1"
How would I go about doing this?
So I believe the last line of this script would be:
perl Program ($Results -join " ")
Does this make sense? If so I will give it a try. Thanks again.

Similar Messages

  • Question about calculation script 'Fix'

    Hi Guys,
    I have a question about calculation script 'Fix'. Below is the sample for my question:
    Dimension 'Period' has members '2009','2010','2011'. We want to Fix the data which 'Period' is not '2009'.
    From Database Administrator's Guide we could use @NOTEQUAL, but version 11.1.1.3.0 seems not support @NOTEQUAL.
    Actually, the dimension is dynamic so we cannot use the way fixing other memebers. What should I do for this requirement?
    Edited by: 842270 on Apr 24, 2011 7:29 PM

    842270 wrote:
    Hi Guys,
    I have a question about calculation script 'Fix'. Below is the sample for my question:
    Dimension 'Period' has members '2009','2010','2011'. We want to Fix the data which 'Period' is not '2009'.
    From Database Administrator's Guide we could use @NOTEQUAL, but version 11.1.1.3.0 seems not support @NOTEQUAL.
    Actually, the dimension is dynamic so we cannot use the way fixing other memebers. What should I do for this requirement?
    Edited by: 842270 on Apr 24, 2011 7:29 PMYou can use @Remove command to avoid 2009.
    @REMOVE
    Removes values or members in one list from another list.
    Syntax
    +@REMOVE (list1, list2)+
    Parameter     Description
    list1
    +     A list of member specifications, from which the members specified in list2 are removed.+
    list2
    A list of member specifications to be removed from list1.

  • [SOLVED]A simple question about bash scripting

    Just for fun, I thought I'd try making Arch as "parent friendly" as possible (i.e., easy to use once set up).  I've already made a nifty little "system maintenance" script that presents you with a "select" bash menu, with options being "Install, Remove, Update [Without AUR, with AUR, abs, exit], Search, Install and Search (using Yaourt), and exit"
    That works wonderfully, and it only requires typing "sm" into the terminal.
    But just to make it yet *more* "parent friendly", I thought I'd make a .desktop file.
    This is the problem.
    I want the shortcut to essentially open up the script in a terminal.  So it would have to execute, say, "xterm" and then open the "sm" script within the called terminal.
    I believe this would mean I need to either add something to my "sm" script or make a new script that opens terminal and calls sm.
    I'm sure this has an easy solution, but I'm a total amateur just having some fun.
    Any suggestions?
    Last edited by hwkiller (2010-07-13 00:32:48)

    I am not a 100% on .desktop files since I never use them.
    but if your command in the desktop file is something like
    xterm -e /path/to/your/sm/file
    that should work.
    EDIT: Bah too late !
    Last edited by Inxsible (2010-07-12 19:27:11)

  • Question about multiple Script declarations

    I'm reading Flash Builder 4 and Flex 4 Bible.
    On page 121 it states:
    "Any particular <fx:Script> element can contain nested ActionScript or use the source property to link to an external Actionscript file, but it cannot do both at the same time. You can, however, have as many <Script> declarations in a single MXML file as you need>"
    My questions are about the last sentence.
    1)  They specifically used <fx:Script> and <Script>. Are these two different entities?
    2)  I've never seen examples of using multiple <fx:Script> declarations in a project. How would this work?
    3)  Are they promoting bad practices by making this claim?
    Thank you
    Kristin

    Although multiple script tags are allowed, I'd guess that they're not commonly used.
    Gordon Smith
    Adobe Flex SDK Team

  • Quick Question About Simple Menu

    Can someone direct me to a link that has a tutorial for a SIMPLE vertical navigation menu with a submenu. Like a drop down menu but vertical where the main links are on the left and the submenues come out the right side of the menu. I dont need any bells and wistles and I am just learning so it doesnt need anything but a button link when rolled over more link options appear to the right. Is there a tutorial that is not a place trying to sell me this capability and actually works (CS3), no errors, broken links etc...just a how to for a SIMPLE menu with submenus.
    Sorry, I am getting frustrated...thanks

    Okay, just so that it might help someone else who is struggling to find a way to do this, I found a pretty good tutorial on how to make good drop down menus that can easily be made into a vertical pop-out menu as well. I was a bit surprised that there was so little valuable information regarding something that I would think is a pretty common thing, SIMPLE rollovers with submenus. Not only did I have a very difficult time JUST finding a tutorial on basic drop down menus (without all kinds of bells and whistles or people wanting to sell me a package), but there was nobody who could actually point me to the one truly helpful tutorial about the subject out there. So for those who might search I am going to put this link here to the only real thorough tutorial I could find about a simple drop down menu that can work both vertical and horizontal.
    It takes awhile because he is also explaining many things most people with basic knowledge about the program probably already knows but its clear and (SHOCK!) actually works well.
    http://www.tutvid.com/tutorials/flash/tutorials/as3DropDownMenus.php

  • Question about PHP scripting

    i just did a PHP script for a web form, it works fine that
    when i press submit, it displays the page said "thanks for
    submitting," but the problem is i never receive the email of the
    data, any idea?

    I agree with GarryCT that you should try a simple test (no
    HTML) to see
    if you can send mail at all. If that succeeds, then try
    building it up
    to the point you're hoping for.
    When sending HTML mail, you /might/ want to consider
    including a plain
    text version and sending multi-part email.
    Anyway, here are some comments I have for the code posted
    here:
    Try
    temporarily turning on display errors.
    > <?php
    ini_set('error_reporting', E_ALL);
    ini_set('display_errors', 1);
    > /*subject and email variables*/
    > $subject = 'php scripting';
    > $me = 'my email';
    > /*gathering data variables*/
    > $name1 = $_POST ['name1'];
    > $name2 = $_POST ['name2'];
    > $email = $_POST ['email'];
    > $company = $_POST ['company'];
    > $brief = $_POST ['brief'];
    >
    > $body = <<<EOD
    > <br><HR><br>
    > First Name: $name1 <br>
    > Last Name: $name2 <br>
    > E-mail Address: $email <br>
    > Company: $company <br>
    > Brief: $brief <br>
    > EOD;
    Hopefully, that indent was caused by the Web forum.
    Otherwise, EOD;
    should be at the very start of the line - no white space[1].
    EOD;
    > $headers = "From: $mail\r\n";
    You have not assigned a value to $mail. Some hosts require
    this to be
    an address in your domain. Try using your $me variable here
    (assuming
    it is a valid email address from this domain).
    > $headers .= "Content-type: text /html\r\n";
    Try removing that extra space. You might also need to add
    mime
    version[2]. Does order make a difference? Try this for the
    $headers
    variable:
    $headers = 'MIME-Version: 1.0' . "\r\n";
    $headers .= 'Content-type: text/html; charset=iso-8859-1' .
    "\r\n";
    $headers .= "From: $me\r\n";
    > $success = mail($me, $subject, $body, $headers);
    You are not acting on the TRUE/FALSE result stored in
    $success.
    Everything after this point assumes mail was accepted for
    delivery. Of
    course, TRUE does not necessarily mean the mail actually got
    to its
    intended destination[2], FALSE does indicate that it was not
    delivered
    at all.
    > /*results rendered as HTML*/
    > $theResults = <<<EOD
    > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
    Transitional//EN"
    > "
    http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    > <html xmlns="
    http://www.w3.org/1999/xhtml">
    > <head>
    > <meta http-equiv="Content-Type" content="text/html;
    charset=utf-8" />
    > <title>Untitled Document</title>
    > </head>
    > <body>Thanks for your time, we'll get back to you
    within a day.
    > </body>
    > </html>
    > EOD;
    Hopefully, that indent was caused by the Web forum.
    Otherwise, EOD;
    should be at the very start of the line - no white space[1].
    EOD;
    > echo "$theResults";
    > ?>
    [1]
    http://php.net/echo (see "here
    document" in examples.)
    [2]
    http://php.net/function.mail
    Mark A. Boyd
    Keep-On-Learnin' :)

  • Question about unix script

    Hi all,
    I know this is not the question for this forum but in case :)) if somebody knows.
    I have a shell script to run this completely I need to enter two times if I run it mannually. Now I want to automate that script and want to call that script from another script. Will anybody tell me how to automate 2nd carriage RETURN.
    Thanks in Advance
    Aqil

    > It doesnot give me any error but it doesnt work.
    When I asked "Does that work?" I meant does that approach work in general? i.e. can you ever have a background command as the subject of a here-document construction? I don't see how that could work, because once the command is kicked off in background in a separate process, how can you feed the rest of the input to it? It would make more sense to write
    needcarriagereturn.sh <<END
    END
    ) &or
    function runmyscript
              needcarriagereturn.sh<<-END
              END
    runmyscript &or perhaps
    echo | needcarriagereturn.sh &Message was edited by:
    William Robertson
    Ignore the ">" character in the middle example. The forum software adds it for some reason.

  • Question about using script library

    Dear Mavens,
    I am writing a script that has lots of predefined text items because it deals with reprocessing certain javascript files.
    Here is an example from the beginning of the script (with the actual javascript code mangled because it seems to mess up the display):
    set sdinTXTcf_imgsrc to "<i_mg src=dfaasfaf"<P>
    set sdinTXTcf_onload to " onLoad="p_arent.frames[1].readystate(sfsafasfads"
    set sdinTXTcf_inBetween to "</d_iv>');
    } else {
    parent.frames[0].document.write('<div align="c_enter"><img src=\""
    this section is now getting quite long and I thought of putting it into an external file. What I was hoping to do is to load all these "set this to that" commands into my script then use them as if they had been defined in it.
    The following is a toy script to demonstrate my problem.
    I wrote a mini library which ilooks thusly:
    set var1 to "VAR1"
    set var22 to "VAR22"
    set var333 to "VAR333"
    Then a mini script that calls the mini library:
    load script file "whatever:toylib.scpt"
    get var1
    The result is
    tell current application
    load script file "whatever:toyscript.scpt"
    set var1 to "VAR1"
    set var22 to "VAR22"
    set var333 to "VAR333"
    "The variable var1 is not defined."
    setting up var1 as global does not help either, either in the scrip or in the library
    Now, I can set up the mini library script as a subroutine to be called, such as
    on toy()
    set var1 to "VAR1"
    set var22 to "VAR22"
    set var333 to "VAR333"
    return {v1:var1, v22:var22, v333:var333}
    end toy
    and in the main scipt I can do a
    set loaded to load script file "whatever:toylib.scpt"
    tell loaded
    set var1 to v1 of toy()
    end tell
    get var1
    which works but it is actually more cumbersome than simply having to scroll down dozens of lines of code on the top of the script.
    I'm sure I'm missing somethig here, your help will be appreaciated
      Mac OS X (10.4.8)  

    Hi Asu,
    There are several ways to do this. The easiest is to
    use properties. Your script library might look like
    this:
    property var1 : "VAR1"
    property var22 : "VAR22"
    property var333 : "VAR333"
    You might load it and get values like this as an
    example:
    set f to choose file -- the script to load
    set s_lib to load script f
    var22 of s_lib
    Note that this is not the only syntax.
    When you do things like 'set' in the script library,
    you need to run the loaded script or subroutines
    within it.
    gl,
    It worked. THANKS!

  • A question about simple transformation

    Hello Experts,
    I wrote a simple transformation according to certain XML structure. But when I ran the transformation with an XML file, an exception will pop up as following
    "Attribute 'requestListId' expected"
    So I executed my program once again in debug mode and go inot the transformation. The exception comes from the following line
    <tt:attribute name="requestListId" value-ref="REQUEST_LIST_ID"/>
    I can open the XML file with IE. I checked the XML carefully and can't find anything wrong.
    I really don't why the exception poped up. 
    Can any expert provide support and help in Transformation programming and Transfromation debug?
    Thanks a lot.
    Best Regards, Johnney.

    Have other solution. So close it.

  • Question about fx:Script

    Hi,
    I have a form using many functions of calculations in fx:Script.
    Can I create a separate file with part of my fx:script? it is getting to long.
    If I can separate this file, can I use this in a different form?
    Thanks!

    You can use the source property:
    <fx:Script source="scripts.as"/>

  • Question about simple Hibernate Programming

    I am trying to use the following Java code to hibernate some
    Java object to a MySQL relational table.
    I wish to avoid the use altogether of *.cfg.xml and *.hbm.xml
    files.
    -Does the following ignore any .cfg.xml file lying present
    under the compiled class?
    -How does one add a property to a Properties object
    to reference the Mappings Object?
    -How does one configure object/method data
    to the fetched Mappings object, as a replacement
    for *.hbm.xml for the corresponding Java object?
    public class TestClass {
    import org.hibernate.cfg.Configuration;.
    import org.hibernate.cfg..Mappings;
    import java.util.Properties;
    //SessionFactory automatically sees Configuraiton.
    public static void main (String [] args)
    Configuration config = new Configuration();
    Properties prop = new Properties();
    prop.setProperty(“hibernate.connection.driver_class”,”com.mysql.jdbc.Drive”);//or other.
    prop.setProperty(“hibernate.connection.username”,”username”;
    prop.setProperty(“hibernate.connection.password”,”password”);
    prop.setProperty(“hibernate.connection.poolsize”,”10”);
    prop.setProperty(“dialect”,”org.hibernate.dialect.MySQLDialect”);
    config.addProperties(prop);
    config.addResource(“/path/to/class/hbm/xml/file/Class.hbm.xml”);
    //If using the object equivalent, what property do I use to
    //refer to the object mappings from the configuration Object?
    Mappings maps = config.createMappings();
    config.buildMappings();
    config.configure();
    //****************************************************************************************************

    corlettk wrote:
    You'll struggle a lot more with the programatic config, coz it's relatively poorly documented (and tested), because you're supposed to just use config files.
    We have to use it to achieve the level of portability required by our tech-arc boffins... and trust me, you don't want to go down that path without a good reason.Plus, of course, if you configure in code, you have to re-compile to re-configure. And if, like us, you have different configs and different domains depending upon where in the world you're deploying, you're a bit stuffed

  • A question about action script 2

    hi all , i do a game with as2 (its an escape game) i have stuck somewhere in as 2. if u help me i will be glad.İ am begginer at flash yet pls help
    i use this code for i take the item to my inv:
    its object code in my inv:
    onClipEvent (load) {
                this.tabEnabled = false;
                this._visible = false;
                orig_x = this._x;
                orig_y = this._y;
    on (press) {
                this.startDrag();
    on (release) {
                this.stopDrag();
                this._x = orig_x;
                this._y = orig_y;
    if (eval(this._droptarget) == _level0.yuk) { 
                            _global.lantern = 1;
                            this._visible = false;
      _level0.gotoAndStop(5);
    its normal object code:
    onClipEvent (load) {
                this.tabEnabled = false;
                if (_global.lantern == 1) {
                            this._visible = false;
    on (release) {
                _global.lantern = 1;
                this._visible = false;
                _level0.lantern_inv._visible = true;
    problem is that my objects doesnt show everyframe in my inventory.
    e.t.c. in frame 1:i take object to my inventory but in second frame:it doesnt show in inventory i wanna player can take object his inv and use it other rooms in my game  didnt able to solve the prob. with layers if u help me i will be glad.
    (sorry for eng)

    i solved problem with that:
    i used variables and after that i dont see two times to my objects at any frame.Coz variable was work.i did keyframes my all frames at layers.Last time i deleted my objects from other frames
    finally:i take one object from 1st frame , use it at 3th frame.Works for now thanx for help
    if i paste my codes to timeline it says:this codes only work for movie clips e.t.c. problem solved for now i hope.
    i like you all ! alwayz need your help

  • A question about SAP script

    Consider a main window, can its width & length be changed/different with first page?

    Most of the time main window in first page will have diffrent position and second page onwards it will have diffrent position .
    one example :
    sales order details - want to print layout form
    requirement will be customer address should be in first page and body will be in first page and next page also.
    first page - we will print customer address and body
    next page onwards we will not print customer address and main window will have more space ,so here we need assign diffrent position.

  • Simple question about mount and delay script

    Hello, I have a simple question about mounting volumes on start up.
    My computer wakes up auto - and then auto there are serveral applescript tasks (mount and start up programs)
    I use this script (daily) for serveral connections with external volumes I always need the connect to. ( In the script I use this code 3 times for other locations) I do this on start up.
    set Uname to "XXX"
    set Pword to "XXX"
    set someVolume to "afp://XXX.XXX.XXX.XXX/XXX/XXX
    mount volume someVolume as user name Uname with password Pword
    (same code for 2 other locations)
    When i do this on start up sometimes the script says there is no connection possible. I guess it's because on start up the connection isn't there. And 1 minute later when computer is total ready the connection is ok. When I run the script then It works. Just sometimes ( In the morning) 'It' want to connect but the script stops. When i do it manually(I run the script again) it works just fine.
    Is it possible that I need a delay? Can someone explain this?
    How would I make a delay handler for this script? Is that the best solution?
    Thanks in advance. This is something small i'm wondering about.
    Colin

    BTW, If you saved the script as an application +(and not as an application bundle)+ you could drop the script on to *Drop Script Backgrounder* (freeware).
    Then the script would run in the background, so, you wouldn't see it running in the Finder.
    <http://www.macupdate.com/info.php/id/7922/drop-script-backgrounder-x>
    Tom

  • Question about DBCA generate script o create RAC database 2 node cluster

    Question about creating two node RAC database 11g after installing and configuration 11g clusterware. I've used DBCA to generate script to create a rac database. I've set
    environment variable ORACLE_SID=RAC and the creating script creates instance of RAC1 and RAC2. My understanding is that each node will represent a node, however there should only be one database with a name of 'RAC'. Please advise

    You are getting your terminology mixed up.
    You only have one database. Take a look, there are one set of datafiles on shared storage.
    You have 2 instances which are accessing one database.
    Database name is RAC. Instance names are RAC1, RAC2, etc, etc.
    Also, if you look at the listener configuration and if your tnsnames is setup properly then connecting to RAC will connect you to either one of the instances wheras connecting to RAC1 will connect you to that instance.

Maybe you are looking for

  • External Optical Drive Not Recognized

    I've been using a Pioneer DVR111 external firewire drive for the last few months. Until tonight it's performed flawlessly. I ripped a couple of CDs into iTunes tonight, then when I tried to do another it wouldn't work. The CD wouldn't mount and the d

  • Services for object buttons randomly disappearing from FB03

    Hello SAP Experts, We display an FI document via tcode FB03 (Display Document) and use the "services for object" buttons to attach documents via the "create attachment" button and also to view attached documents via the "attachment list" button. Howe

  • Can't get get_blob_file_src to work in my application

    Application is on apex.oracle.com Workspace : partituren username: demo password: ZaGreb_12 application: 32570 collectiebeheer Page 5: Person details. Problem: I have a separate region to display the image which is in P5_PORTRAIT. However: what I see

  • UWL Substitution Rule Issue

    Hi All, We are facing some issues with Substitution rule in UWL on NW portal 7.3 SPS08 Issue described below, One user has created substitution rule by selecting task type "All" and "Fill In For me" option. So, as per the standard process this is vis

  • Exporting QT movie that works for any browser

    I started with a 922 MB slideshow with music exported from itunes saved from QT for web it is 4KB will play in QT only if you set connection speed to slow modem (28.8/33.6 Kbps) and not at all in some Explorer Browsers even with the QT plugin. I noti