<?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: mini-document management script. IF statement question in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/mini-document-management-script-if-statement-question/m-p/5144820#M683345</link>
    <description>Sorry, my reply lost the indentation.</description>
    <pubDate>Thu, 04 Dec 2008 22:32:00 GMT</pubDate>
    <dc:creator>Mark McDonald_2</dc:creator>
    <dc:date>2008-12-04T22:32:00Z</dc:date>
    <item>
      <title>mini-document management script. IF statement question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/mini-document-management-script-if-statement-question/m-p/5144817#M683342</link>
      <description>Wanted to check and see whether someone might have some insights on how to write a script that will copy files from one location to a second location. &lt;BR /&gt;&lt;BR /&gt;I have a source and a destination. &lt;BR /&gt;&lt;BR /&gt;If the file exists on source and destination with the same name, check to see if the source is newer. if the source file is newer overwrite the destination..&lt;BR /&gt; &lt;BR /&gt;I think the statement would look like this: &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;if [ "$source" -nt "$destination" ]&lt;BR /&gt;then &lt;BR /&gt;cp $source $destination &lt;BR /&gt;else &lt;BR /&gt;echo Destination $destination is a newer file &lt;BR /&gt;fi &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I define a bunch of variables that set precedent for values in the $source and $destination.. &lt;BR /&gt;These are CIFS mounted file systems. Scripting solution on Un*x that mounts the file systems in questions and copies from Location A to Location B. &lt;BR /&gt;&lt;BR /&gt;I think I may have my nesting wrong in my scripting &lt;BR /&gt;any ideas, suggestions or methods would be appreciated greatly.. &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 04 Dec 2008 21:42:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/mini-document-management-script-if-statement-question/m-p/5144817#M683342</guid>
      <dc:creator>rmueller58</dc:creator>
      <dc:date>2008-12-04T21:42:33Z</dc:date>
    </item>
    <item>
      <title>Re: mini-document management script. IF statement question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/mini-document-management-script-if-statement-question/m-p/5144818#M683343</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; I think I may have my nesting wrong in my scripting &lt;BR /&gt;&lt;BR /&gt;Syntatically this is ok.  What makes you think this is wrong?&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 04 Dec 2008 22:21:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/mini-document-management-script-if-statement-question/m-p/5144818#M683343</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2008-12-04T22:21:05Z</dc:date>
    </item>
    <item>
      <title>Re: mini-document management script. IF statement question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/mini-document-management-script-if-statement-question/m-p/5144819#M683344</link>
      <description>I would try something like&lt;BR /&gt;&lt;BR /&gt;cd source_dir&lt;BR /&gt;for $source in `ls`&lt;BR /&gt;do&lt;BR /&gt;  if $source does not exist in dest_dir&lt;BR /&gt;    then copy it&lt;BR /&gt;  else&lt;BR /&gt;      if [ "$source" -nt "$destination" ]&lt;BR /&gt;         cp $source $destination&lt;BR /&gt;      else&lt;BR /&gt;         echo Destination is newer&lt;BR /&gt;      fi       &lt;BR /&gt;  fi&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;this could probably be done with "elif" too?</description>
      <pubDate>Thu, 04 Dec 2008 22:31:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/mini-document-management-script-if-statement-question/m-p/5144819#M683344</guid>
      <dc:creator>Mark McDonald_2</dc:creator>
      <dc:date>2008-12-04T22:31:08Z</dc:date>
    </item>
    <item>
      <title>Re: mini-document management script. IF statement question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/mini-document-management-script-if-statement-question/m-p/5144820#M683345</link>
      <description>Sorry, my reply lost the indentation.</description>
      <pubDate>Thu, 04 Dec 2008 22:32:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/mini-document-management-script-if-statement-question/m-p/5144820#M683345</guid>
      <dc:creator>Mark McDonald_2</dc:creator>
      <dc:date>2008-12-04T22:32:00Z</dc:date>
    </item>
    <item>
      <title>Re: mini-document management script. IF statement question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/mini-document-management-script-if-statement-question/m-p/5144821#M683346</link>
      <description>James, &lt;BR /&gt;&lt;BR /&gt;I've not use the -nt argument before, we have a web server that allows for job applicants to attach documents, the script takes files from a web server folder and moves them to a CIFS mounted file system for viewing from a 4GL application. often times the copy will bomb out.. or miss a file.. &lt;BR /&gt;&lt;BR /&gt;There is a process where we also copy files back to the webserver, the HR clerk will load files into a staging area, and I will list the files and copy them. Last night she loaded 27 files and 6 were missed. For the I create directories if non exist, before the move. What was supposed to have been a temporary work around is now a production must have and it isn't meeting my reliability wishes. &lt;BR /&gt;&lt;BR /&gt;Below is one of the problem scripts. I am wandering it the reliability issues is related to a CIFS issue. Right now all files are moved. I'd like to do only those of "today's date" &lt;BR /&gt;That is would reduce network over head and perhaps eliminate timeing issues. &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;#!/bin/bash &lt;BR /&gt;#/bin/umount /mps-docs&lt;BR /&gt;#/bin/mount /mps-docs&lt;BR /&gt;echo Check mount &lt;BR /&gt;export p1=/upload_resumes/&lt;BR /&gt;export p2=/upload_resumes/backup/&lt;BR /&gt;export wst=/wst-docs/applicant/&lt;BR /&gt;export mps=/mps-docs/mps-docs/applicant/&lt;BR /&gt;export esu=/esu-docs/applicant/&lt;BR /&gt;export plv=/plv-docs/&lt;BR /&gt;#export ral=/ral-docs/applicant/&lt;BR /&gt;date &amp;gt; /tmp/movetime.log &lt;BR /&gt;echo "MOVE LOG " &amp;gt; movelog.log &lt;BR /&gt;echo NEW&lt;BR /&gt;for fn in `ls /upload_resumes/`&lt;BR /&gt;do&lt;BR /&gt;for dist in `echo $fn |awk '{print substr($1,1,3)}'`&lt;BR /&gt;# DISTRICT SPECIFIC INFORMATION&lt;BR /&gt;do&lt;BR /&gt;export dist&lt;BR /&gt;&lt;BR /&gt;case $dist in&lt;BR /&gt;wst)&lt;BR /&gt;export distpath="$wst"&lt;BR /&gt;;;&lt;BR /&gt;mps)&lt;BR /&gt;export distpath="$mps"&lt;BR /&gt;;;&lt;BR /&gt;esu)&lt;BR /&gt;export distpath="$esu"&lt;BR /&gt;;;&lt;BR /&gt;plv)&lt;BR /&gt;export distpath="$plv"&lt;BR /&gt;;;&lt;BR /&gt;#ral)&lt;BR /&gt;#export distpath="$ral"&lt;BR /&gt;#;;&lt;BR /&gt;*)&lt;BR /&gt;;;&lt;BR /&gt;esac&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;#APPID SPECIFIC INFORMATION&lt;BR /&gt;for appid in `echo $fn |awk -F_ '{print $2}'`&lt;BR /&gt;do&lt;BR /&gt;        echo FILENAME: $fn&lt;BR /&gt;        export source="$p1$fn"&lt;BR /&gt;        echo $source&lt;BR /&gt;        export destination="$distpath$appid/$fn"&lt;BR /&gt;        echo DONE&lt;BR /&gt;&lt;BR /&gt;if [ -f "$destination" ] &lt;BR /&gt;then &lt;BR /&gt;echo "$destination" Exists &lt;BR /&gt;#rsync -uv  $source $destination&lt;BR /&gt;else&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;if [ -d "$distpath$appid" ]&lt;BR /&gt;then&lt;BR /&gt;#cp -f $source $destination&lt;BR /&gt;rsync -uv  $source $destination&lt;BR /&gt;#&lt;BR /&gt;# File Checking logging #&lt;BR /&gt;ls -la  $source &amp;gt; /tmp/movesource.log &lt;BR /&gt;ls -la $destination &amp;gt; /tmp/movedestination.log &lt;BR /&gt;echo "Source Files" &amp;gt;&amp;gt; /tmp/movelog.log &lt;BR /&gt;cat  /tmp/movesource.log &amp;gt;&amp;gt; /tmp/movelog.log &lt;BR /&gt;echo "Destination Files" &amp;gt;&amp;gt; /tmp/movelog.log &lt;BR /&gt;cat  /tmp/movedestination.log &amp;gt;&amp;gt; /tmp/movelog.log &lt;BR /&gt;#&lt;BR /&gt;#&lt;BR /&gt;#################################################&lt;BR /&gt;else&lt;BR /&gt;mkdir $distpath$appid&lt;BR /&gt;mkdir $distpath$appid/Transcripts&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;fi&lt;BR /&gt;#export backup="$p2`date +%Y%m%d`$fn"&lt;BR /&gt;ls $distpath &amp;gt; /tmp/"$dist"path&lt;BR /&gt;&lt;BR /&gt;#cp -f $source $destination&lt;BR /&gt;#END OF APPID SPECIFIC INFORMATION&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;#END OF DISTRICT SPECIFIC FILE MANIPULATION&lt;BR /&gt;done&lt;BR /&gt;# END PROGRAM&lt;BR /&gt;done&lt;BR /&gt;rm -f /tmp/*path&lt;BR /&gt;cd /root&lt;BR /&gt;date &amp;gt;&amp;gt; /tmp/movetime.log &lt;BR /&gt;echo "File Completion Summary " &amp;gt;&amp;gt; /tmp/movelog.log&lt;BR /&gt;cat /tmp/movetime.log &amp;gt;&amp;gt; /tmp/movelog.log&lt;BR /&gt;echo "File Contents Summary" &amp;gt;&amp;gt; /tmp/movelog.log &lt;BR /&gt;echo ############################################# &amp;gt;&amp;gt; /tmp/movelog.log &lt;BR /&gt;mail -s "Move Log `date` " address@domainname.TLD &amp;lt; /tmp/movelog.log &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 04 Dec 2008 22:34:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/mini-document-management-script-if-statement-question/m-p/5144821#M683346</guid>
      <dc:creator>rmueller58</dc:creator>
      <dc:date>2008-12-04T22:34:31Z</dc:date>
    </item>
    <item>
      <title>Re: mini-document management script. IF statement question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/mini-document-management-script-if-statement-question/m-p/5144822#M683347</link>
      <description>Found resolution and re-wrote script, to eliminate dups and redundancy.</description>
      <pubDate>Tue, 16 Dec 2008 15:54:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/mini-document-management-script-if-statement-question/m-p/5144822#M683347</guid>
      <dc:creator>rmueller58</dc:creator>
      <dc:date>2008-12-16T15:54:54Z</dc:date>
    </item>
  </channel>
</rss>

