<?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: Script Help - Coping and Moving Files in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help-coping-and-moving-files/m-p/2710161#M723583</link>
    <description>Hello Laurie,&lt;BR /&gt;&lt;BR /&gt;are you certain that you do NOT want any checks wether the file to be copied/moved does not already EXIST in the target directory (deleting the existing one!)???&lt;BR /&gt;&lt;BR /&gt;Just my $0.02,&lt;BR /&gt;Wodisch&lt;BR /&gt;</description>
    <pubDate>Thu, 25 Apr 2002 15:23:46 GMT</pubDate>
    <dc:creator>Wodisch</dc:creator>
    <dc:date>2002-04-25T15:23:46Z</dc:date>
    <item>
      <title>Script Help - Coping and Moving Files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help-coping-and-moving-files/m-p/2710152#M723574</link>
      <description>Hi HP Techies,&lt;BR /&gt;&lt;BR /&gt;I have a technical question concerning a script. I want to copy and move files from one directory to another, but not if the files are being uploaded at the time.  That would be a bad thing.&lt;BR /&gt;&lt;BR /&gt;So, I need to add a piece that can read the file size, wait for 3-5 seconds,&lt;BR /&gt;read the file size again and then loop if they're not the same, which will wait another 3-5 seconds.  Once the files are the same size, Then continue with the script.&lt;BR /&gt;&lt;BR /&gt;Attached is a copy of my 1 page script.&lt;BR /&gt;&lt;BR /&gt;Thank you for your help,&lt;BR /&gt;Laurie&lt;BR /&gt;lauriek@mail.park.edu</description>
      <pubDate>Wed, 24 Apr 2002 14:27:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help-coping-and-moving-files/m-p/2710152#M723574</guid>
      <dc:creator>Laurie_2</dc:creator>
      <dc:date>2002-04-24T14:27:08Z</dc:date>
    </item>
    <item>
      <title>Re: Script Help - Coping and Moving Files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help-coping-and-moving-files/m-p/2710153#M723575</link>
      <description>Hi Laurie&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;You need to put a test condition in the script&lt;BR /&gt;which goes like this :&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;while true&lt;BR /&gt;&lt;BR /&gt;do&lt;BR /&gt;&lt;BR /&gt;export SIZE=`ls -l filename | awk '{print $7}'`&lt;BR /&gt;&lt;BR /&gt;if [ $SIZE = &amp;lt; expected size &amp;gt; ]&lt;BR /&gt;&lt;BR /&gt;then&lt;BR /&gt;&lt;BR /&gt;(command to be run)&lt;BR /&gt;&lt;BR /&gt;exit&lt;BR /&gt;&lt;BR /&gt;fi &lt;BR /&gt;&lt;BR /&gt;sleep 90&lt;BR /&gt;&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;where file name is the name of the file which is expected to reach the &lt;EXPEXTED size=""&gt; , you can also put a greater size or lesse than size condition.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Manoj Srivastava&lt;/EXPEXTED&gt;</description>
      <pubDate>Wed, 24 Apr 2002 14:37:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help-coping-and-moving-files/m-p/2710153#M723575</guid>
      <dc:creator>MANOJ SRIVASTAVA</dc:creator>
      <dc:date>2002-04-24T14:37:49Z</dc:date>
    </item>
    <item>
      <title>Re: Script Help - Coping and Moving Files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help-coping-and-moving-files/m-p/2710154#M723576</link>
      <description>Hi Laurie:&lt;BR /&gt;&lt;BR /&gt;Let me give you a somewhat better way to do this. Call my fileage.pl script. It will silently report if a file has been modified within a given period of time. It exits with a 0 status if not and a status of 1 if the file has been modified. This is better than looking at file sizes. I would also look at a bit longer time period than 3-5 seconds.&lt;BR /&gt;&lt;BR /&gt;In your script, do something like this:&lt;BR /&gt;&lt;BR /&gt;SECONDS=30&lt;BR /&gt;fileage.pl -m -s ${SECONDS} ${YOURFILE}&lt;BR /&gt;STAT=$?&lt;BR /&gt;if [ ${STAT} -eq 0 ]&lt;BR /&gt;then&lt;BR /&gt;echo "File ${YOURFILE} not been modified in"&lt;BR /&gt;echo "${SECONDS}. It is safe to transfer."&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;You can execute fileage.pl -u for full usage.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 24 Apr 2002 14:39:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help-coping-and-moving-files/m-p/2710154#M723576</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2002-04-24T14:39:55Z</dc:date>
    </item>
    <item>
      <title>Re: Script Help - Coping and Moving Files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help-coping-and-moving-files/m-p/2710155#M723577</link>
      <description>A few changes I would make&lt;BR /&gt;&lt;BR /&gt;for FILE in `ls dir`&lt;BR /&gt;  do&lt;BR /&gt;  SIZE1=`ll $FILE | awk '{print $7}'`&lt;BR /&gt;  sleep 5&lt;BR /&gt;  SIZE2=`ll $FILE | awk '{print $7}'`&lt;BR /&gt;    if [ $SIZE2 -eq $SIZE1 ]&lt;BR /&gt;      then&lt;BR /&gt;        execute command&lt;BR /&gt;      else&lt;BR /&gt;        don't execute&lt;BR /&gt;    fi&lt;BR /&gt;   done&lt;BR /&gt;&lt;BR /&gt;GL,&lt;BR /&gt;C</description>
      <pubDate>Wed, 24 Apr 2002 14:42:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help-coping-and-moving-files/m-p/2710155#M723577</guid>
      <dc:creator>Craig Rants</dc:creator>
      <dc:date>2002-04-24T14:42:15Z</dc:date>
    </item>
    <item>
      <title>Re: Script Help - Coping and Moving Files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help-coping-and-moving-files/m-p/2710156#M723578</link>
      <description>Untested:&lt;BR /&gt;&lt;BR /&gt;#!/opt/perl/bin/perl -w&lt;BR /&gt;&lt;BR /&gt;# copycheck sourcedir destdir&lt;BR /&gt;&lt;BR /&gt;use strict;&lt;BR /&gt;&lt;BR /&gt;my ($sourcedir, $destdir) = @ARGV;&lt;BR /&gt;&lt;BR /&gt;use File::Find;&lt;BR /&gt;use File::Copy;&lt;BR /&gt;&lt;BR /&gt;find (sub {&lt;BR /&gt;$^T = time; # Now is now&lt;BR /&gt;-M &amp;lt; 0.02 and return;# File too new&lt;BR /&gt;copy $_, $destdir/$_";&lt;BR /&gt;}, $sourcedir);</description>
      <pubDate>Wed, 24 Apr 2002 14:44:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help-coping-and-moving-files/m-p/2710156#M723578</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2002-04-24T14:44:53Z</dc:date>
    </item>
    <item>
      <title>Re: Script Help - Coping and Moving Files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help-coping-and-moving-files/m-p/2710157#M723579</link>
      <description>Sorry, tested, missing $_&lt;BR /&gt;&lt;BR /&gt;#!/opt/perl/bin/perl -w&lt;BR /&gt;&lt;BR /&gt;# copycheck sourcedir destdir&lt;BR /&gt;&lt;BR /&gt;use strict;&lt;BR /&gt;&lt;BR /&gt;my ($sourcedir, $destdir) = @ARGV;&lt;BR /&gt;&lt;BR /&gt;use File::Find;&lt;BR /&gt;use File::Copy;&lt;BR /&gt;&lt;BR /&gt;find (sub {&lt;BR /&gt;    $^T = time; # Now is now&lt;BR /&gt;    -M $_ &amp;lt; 0.02 and return;# File too new&lt;BR /&gt;    copy $_, $destdir/$_;&lt;BR /&gt;    }, $sourcedir);</description>
      <pubDate>Wed, 24 Apr 2002 14:50:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help-coping-and-moving-files/m-p/2710157#M723579</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2002-04-24T14:50:30Z</dc:date>
    </item>
    <item>
      <title>Re: Script Help - Coping and Moving Files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help-coping-and-moving-files/m-p/2710158#M723580</link>
      <description>I suggest you check if the file is open. Means the file isn't open if the download is completed.&lt;BR /&gt;Look at this sample script:&lt;BR /&gt;&lt;BR /&gt;OPEN=`fuser ${YOUR_FILE} 2&amp;gt;/dev/null`&lt;BR /&gt;while [ "$OPEN" != "" ]&lt;BR /&gt;do&lt;BR /&gt;sleep 1&lt;BR /&gt;OPEN=`fuser ${YOUR_FILE} 2&amp;gt;/dev/null`&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Hope this helps&lt;BR /&gt;Ruediger&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 24 Apr 2002 14:58:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help-coping-and-moving-files/m-p/2710158#M723580</guid>
      <dc:creator>Ruediger Noack</dc:creator>
      <dc:date>2002-04-24T14:58:55Z</dc:date>
    </item>
    <item>
      <title>Re: Script Help - Coping and Moving Files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help-coping-and-moving-files/m-p/2710159#M723581</link>
      <description>Ruediger, a *very* good point, but remember that by default fuser cannot be invoked by other than the root user. (probably because of the -k option :) and the access to kernel memory). If you live in a secure environment where you trust everyone, you can open up execution rights to fuser, or write a small wrapper with setuit-root that only allows fuser on specific files.</description>
      <pubDate>Wed, 24 Apr 2002 15:02:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help-coping-and-moving-files/m-p/2710159#M723581</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2002-04-24T15:02:51Z</dc:date>
    </item>
    <item>
      <title>Re: Script Help - Coping and Moving Files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help-coping-and-moving-files/m-p/2710160#M723582</link>
      <description>Hi procura,&lt;BR /&gt;&lt;BR /&gt;thanks for your reply.&lt;BR /&gt;I know that only root can get access to the kernel and can run command fuser.&lt;BR /&gt;But I found in Lauries script the chown command. Therefore I thought the script will be started from root.&lt;BR /&gt;&lt;BR /&gt;Ruediger&lt;BR /&gt;</description>
      <pubDate>Thu, 25 Apr 2002 05:17:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help-coping-and-moving-files/m-p/2710160#M723582</guid>
      <dc:creator>Ruediger Noack</dc:creator>
      <dc:date>2002-04-25T05:17:08Z</dc:date>
    </item>
    <item>
      <title>Re: Script Help - Coping and Moving Files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help-coping-and-moving-files/m-p/2710161#M723583</link>
      <description>Hello Laurie,&lt;BR /&gt;&lt;BR /&gt;are you certain that you do NOT want any checks wether the file to be copied/moved does not already EXIST in the target directory (deleting the existing one!)???&lt;BR /&gt;&lt;BR /&gt;Just my $0.02,&lt;BR /&gt;Wodisch&lt;BR /&gt;</description>
      <pubDate>Thu, 25 Apr 2002 15:23:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help-coping-and-moving-files/m-p/2710161#M723583</guid>
      <dc:creator>Wodisch</dc:creator>
      <dc:date>2002-04-25T15:23:46Z</dc:date>
    </item>
  </channel>
</rss>

