<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: File Manager Shell Script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/file-manager-shell-script/m-p/2713232#M721606</link>
    <description>Just my idea .. assumptions ..&lt;BR /&gt;1) new file that comes in has the "number" part of the filename always incremental.&lt;BR /&gt;&lt;BR /&gt;First store the "ls|sort|wc" variable (call it $WC) to keep track of how many files you currently have, sorted.&lt;BR /&gt;&lt;BR /&gt;After 5 minutes run "ls|sort|wc" again (store in $WCNEW). Take the value of (($WCNEW-$WC)) and if it's equal to zero (0) don't do anything because no new files have come in. If it's not equal to zero (ie 1 or more), then you would do "ls|sort|tail -${difference-between-$WC2-$WC}" to extract the filename of the new ones and only processed those.</description>
    <pubDate>Mon, 29 Apr 2002 16:22:27 GMT</pubDate>
    <dc:creator>S.K. Chan</dc:creator>
    <dc:date>2002-04-29T16:22:27Z</dc:date>
    <item>
      <title>File Manager Shell Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/file-manager-shell-script/m-p/2713228#M721602</link>
      <description>&lt;BR /&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;I have a problem:&lt;BR /&gt;I need to check , each 5 minutes, the files names that are being generated at the dir /in&lt;BR /&gt;An example of the files names is acc12309889 and the number increase.&lt;BR /&gt;I need to check all the files acc in the /dir and execute a command like sciptname acc123XXXX for all the acc in the path /dir.&lt;BR /&gt;After 5 minutes we have more acc but I want to execute the script only for the new ones and not for the olds that I did before. I know that I need to send then to file with a list contents all file names but I??d like to implemented a better solution. &lt;BR /&gt;</description>
      <pubDate>Mon, 29 Apr 2002 15:46:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/file-manager-shell-script/m-p/2713228#M721602</guid>
      <dc:creator>Ricardo Bassoi</dc:creator>
      <dc:date>2002-04-29T15:46:01Z</dc:date>
    </item>
    <item>
      <title>Re: File Manager Shell Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/file-manager-shell-script/m-p/2713229#M721603</link>
      <description>Could you create a folder called "/in_processed"? That way after you have processed a file, you could move it to that folder and it won't be re-processed again.&lt;BR /&gt;&lt;BR /&gt;-- Rod Hills</description>
      <pubDate>Mon, 29 Apr 2002 15:47:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/file-manager-shell-script/m-p/2713229#M721603</guid>
      <dc:creator>Rodney Hills</dc:creator>
      <dc:date>2002-04-29T15:47:45Z</dc:date>
    </item>
    <item>
      <title>Re: File Manager Shell Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/file-manager-shell-script/m-p/2713230#M721604</link>
      <description>if you can modify your script (or add a wrap-around script) that tracks the last file handled that you can store somewhere, you can then use "find" to pick-up just the files you want:&lt;BR /&gt;&lt;BR /&gt;find /in -newer $LAST_FILE -print |xargs -1 [your script] {}&lt;BR /&gt;&lt;BR /&gt;where $LAST_FILE is the file name last handled by the script.&lt;BR /&gt;&lt;BR /&gt;HTH&lt;BR /&gt;mark</description>
      <pubDate>Mon, 29 Apr 2002 16:02:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/file-manager-shell-script/m-p/2713230#M721604</guid>
      <dc:creator>Mark Greene_1</dc:creator>
      <dc:date>2002-04-29T16:02:33Z</dc:date>
    </item>
    <item>
      <title>Re: File Manager Shell Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/file-manager-shell-script/m-p/2713231#M721605</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;why not change the processing script to change the filename to filename.processed in the last line. Then when you execute the script execute it on all files except not containing the string .processed.&lt;BR /&gt;&lt;BR /&gt;john.</description>
      <pubDate>Mon, 29 Apr 2002 16:13:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/file-manager-shell-script/m-p/2713231#M721605</guid>
      <dc:creator>John Carr_2</dc:creator>
      <dc:date>2002-04-29T16:13:22Z</dc:date>
    </item>
    <item>
      <title>Re: File Manager Shell Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/file-manager-shell-script/m-p/2713232#M721606</link>
      <description>Just my idea .. assumptions ..&lt;BR /&gt;1) new file that comes in has the "number" part of the filename always incremental.&lt;BR /&gt;&lt;BR /&gt;First store the "ls|sort|wc" variable (call it $WC) to keep track of how many files you currently have, sorted.&lt;BR /&gt;&lt;BR /&gt;After 5 minutes run "ls|sort|wc" again (store in $WCNEW). Take the value of (($WCNEW-$WC)) and if it's equal to zero (0) don't do anything because no new files have come in. If it's not equal to zero (ie 1 or more), then you would do "ls|sort|tail -${difference-between-$WC2-$WC}" to extract the filename of the new ones and only processed those.</description>
      <pubDate>Mon, 29 Apr 2002 16:22:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/file-manager-shell-script/m-p/2713232#M721606</guid>
      <dc:creator>S.K. Chan</dc:creator>
      <dc:date>2002-04-29T16:22:27Z</dc:date>
    </item>
    <item>
      <title>Re: File Manager Shell Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/file-manager-shell-script/m-p/2713233#M721607</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;there are already good solutions the other authors gave to you.&lt;BR /&gt;&lt;BR /&gt;Another possibility is to use the constraint that the number used to build the filename is increasing.&lt;BR /&gt;&lt;BR /&gt;1)  The 1st time your script runs, the filename of the last processed file should be stored somewhere in a reserved place, e.g. /etc/tmp/in/last_processed_file.&lt;BR /&gt;&lt;BR /&gt;2)  The 2nd time your script runs, a list of filenames should be created with e.g. 'ls -1t'. Process this list of filenames starting at the top, and stop the process when the actual position of the list of filenames shows the filename stored in /etc/tmp/in/last_processed_file.&lt;BR /&gt;&lt;BR /&gt;3)  Before ending the script, store the filename of the last processed file in /etc/tmp/in/last_processed_file.&lt;BR /&gt;&lt;BR /&gt;Maybe, you want to choose this solution.</description>
      <pubDate>Mon, 29 Apr 2002 16:33:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/file-manager-shell-script/m-p/2713233#M721607</guid>
      <dc:creator>Thomas Schler_1</dc:creator>
      <dc:date>2002-04-29T16:33:51Z</dc:date>
    </item>
    <item>
      <title>Re: File Manager Shell Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/file-manager-shell-script/m-p/2713234#M721608</link>
      <description>&lt;BR /&gt;Hi All,&lt;BR /&gt;&lt;BR /&gt;Thanks by all the tips. I cannot change the file names extension and not copy to another dir.&lt;BR /&gt;In the attachment I have the list of file names that I collected just using:&lt;BR /&gt; ls acc* &amp;gt; processed&lt;BR /&gt;Now I need to execute a program:&lt;BR /&gt;  scriptname accXXXXX&lt;BR /&gt;for each one of the file name in the list.&lt;BR /&gt;I need to check the last one and at the next time only execute the scipt again for the new ones &lt;BR /&gt;</description>
      <pubDate>Mon, 29 Apr 2002 16:42:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/file-manager-shell-script/m-p/2713234#M721608</guid>
      <dc:creator>Ricardo Bassoi</dc:creator>
      <dc:date>2002-04-29T16:42:38Z</dc:date>
    </item>
    <item>
      <title>Re: File Manager Shell Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/file-manager-shell-script/m-p/2713235#M721609</link>
      <description>Hi Ricardo,&lt;BR /&gt;&lt;BR /&gt;just a few more thoughts:&lt;BR /&gt;&lt;BR /&gt;man touch&lt;BR /&gt;&lt;BR /&gt;you can create a reference file with touch command which you can give the desired time stamp. After this you use the find- command to find newer files than your reference file.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;man cut&lt;BR /&gt;&lt;BR /&gt;if your file names are allways the same way, use the cut- command to get what you need: An increasing number...&lt;BR /&gt;&lt;BR /&gt;echo filename | cut -c4-&lt;BR /&gt;&lt;BR /&gt;cuts out only the characters beginning from 4 to the end. What you get is a number which you can use in a if- construction:&lt;BR /&gt;&lt;BR /&gt;if [ number -gt reference_number ]&lt;BR /&gt;then&lt;BR /&gt;      desired_action&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;Allways stay on the bright side of life!&lt;BR /&gt;&lt;BR /&gt;Peter</description>
      <pubDate>Mon, 29 Apr 2002 16:53:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/file-manager-shell-script/m-p/2713235#M721609</guid>
      <dc:creator>Peter Kloetgen</dc:creator>
      <dc:date>2002-04-29T16:53:17Z</dc:date>
    </item>
    <item>
      <title>Re: File Manager Shell Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/file-manager-shell-script/m-p/2713236#M721610</link>
      <description>Hi Ricardo&lt;BR /&gt;&lt;BR /&gt;Now you have file processed.&lt;BR /&gt;&lt;BR /&gt;for i in `cat processed`&lt;BR /&gt;do&lt;BR /&gt;  script ${i}&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;That will run script for all names in processed file&lt;BR /&gt;&lt;BR /&gt;to get the last entry from processed&lt;BR /&gt;last -1 processed.&lt;BR /&gt;&lt;BR /&gt;Sachin</description>
      <pubDate>Mon, 29 Apr 2002 17:02:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/file-manager-shell-script/m-p/2713236#M721610</guid>
      <dc:creator>Sachin Patel</dc:creator>
      <dc:date>2002-04-29T17:02:55Z</dc:date>
    </item>
    <item>
      <title>Re: File Manager Shell Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/file-manager-shell-script/m-p/2713237#M721611</link>
      <description>Sorry it is&lt;BR /&gt;tail -1 processed (to get last entry). &lt;BR /&gt;&lt;BR /&gt;using same loop you can move processed files in to different dir. or if you don't want to move files then&lt;BR /&gt;&lt;BR /&gt;ls acc* |sort &amp;gt; processed&lt;BR /&gt;do the process on each file as I said in previous reply.&lt;BR /&gt;&lt;BR /&gt;then second time&lt;BR /&gt;ls acc* | sort &amp;gt; processed1&lt;BR /&gt;&lt;BR /&gt;diff processed processed1 &amp;gt; newprocessed&lt;BR /&gt;&lt;BR /&gt;run script on newprocessed now.&lt;BR /&gt;&lt;BR /&gt;before finishing join processed and newproced. now third time you will have processed is list of acc* which you pass on first on second phase.&lt;BR /&gt;&lt;BR /&gt;Sachin&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 29 Apr 2002 17:08:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/file-manager-shell-script/m-p/2713237#M721611</guid>
      <dc:creator>Sachin Patel</dc:creator>
      <dc:date>2002-04-29T17:08:38Z</dc:date>
    </item>
    <item>
      <title>Re: File Manager Shell Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/file-manager-shell-script/m-p/2713238#M721612</link>
      <description>you can do this without modifying either your existing script or any file or directory names:&lt;BR /&gt;&lt;BR /&gt;run this script, which will call your existing one.  this script will manage which file names to run your exising script with:&lt;BR /&gt;&lt;BR /&gt;#!/bin/ksh&lt;BR /&gt;if [ -s /tmp/LAST_FILE ]; then&lt;BR /&gt;   echo `ls -ltr |tail -1|tr -s " "||cut -d" " -f9` &amp;gt;/tmp/LAST_FILE&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;LAST_FILE=`cat /tmp/LAST_FILE`&lt;BR /&gt;&lt;BR /&gt;FILE_LIST=`find /in -newer $LAST_FILE -print`&lt;BR /&gt;&lt;BR /&gt;for FILE_NAME in `echo $FILE_LIST`; do&lt;BR /&gt; your_script $FILE_NAME&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;echo $FILE_NAME &amp;gt;/tmp/LAST_FILE&lt;BR /&gt;exit&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;the "find" will isolate the files you've not done, and by running the lists to variable, this will eliminate any race-conditions between processing file and new files getting created.&lt;BR /&gt;&lt;BR /&gt;HTH&lt;BR /&gt;mark</description>
      <pubDate>Mon, 29 Apr 2002 17:44:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/file-manager-shell-script/m-p/2713238#M721612</guid>
      <dc:creator>Mark Greene_1</dc:creator>
      <dc:date>2002-04-29T17:44:53Z</dc:date>
    </item>
  </channel>
</rss>

