Mark S. wrote:

> I'm not a PowerShell aficionado, so even a short script takes some time. 
>

Ciao Mark

In the process of noodling about with your script I made a few, mainly 
cosmetic, changes. The only real difference is to be able to put the script 
anywhere (I hope :-).

Merely suggestive. Related to previous post to TonyM.

Best wishes
Josiah

Set-ExecutionPolicy -scope CurrentUser -executionPolicy Unrestricted

# SETTINGS -----------------------------------

  # --- WIKI STEM NAMES: list of wiki stem names
  # Wiki name stem must be unique!! Case sensitive naming!!
  $stemlist = @("wiki1","wiki2")

  # --- WIKI DIRECTORIES: list in same order as stem names
  $dirlist = @("C:\scrap\wiki1","C:\scrap\test\wiki2")

  # --- DOWNLOADS DIRECTORY: where your browser(s) save downloads
  $downloaddir = "C:\Users\Josiah\Downloads"

  # --- TIMING: How many seconds to wait between checks
  $waitSeconds = 60

# SCRIPT --------------------------------------
cls
cd $downloaddir
echo ""
echo "  | NINE-LIVES v0.1 (test)"
echo "  |"
echo "  | Every $waitSeconds secs checks for new saves in ..."
echo "  |"
echo "  | $downloaddir "
echo "  |"
echo "  | Press [Ctrl+C] to exit"
echo ""

while(1) {
    for($i=0;$i -lt $stemlist.Length; $i++) {
      $stem = $stemlist[$i]
      $stem
      $dir = $dirlist[$i]
      #$dir
      $copyme = ls $stem*.html | sort LastWriteTime | select -last 1
      $copyme = $copyme.FullName
      #$copyme
      $destination = Get-Item  "$dir\$stem.html"
      $source = Get-Item "$copyme" 
      #echo Source: $source.LastWriteTime
      #echo Destination: $destination.LastWriteTime 
      If($source.LastWriteTime -gt $destination.LastWriteTime.addSeconds(1) 
) {
      #echo "Source: " $source.LastWriteTime "greater than " 
$destination.LastWriteTime.addSeconds(1) 
        Copy-Item $copyme -Destination "$dir\$stem.html"
        echo "  Copying $copyme to $dir\$stem.html"
        echo ""
      } Else {
        echo "  ... is unchanged" 
        echo ""
      }
    }
    echo "  | Sleep for $waitSeconds seconds ..."
    start-sleep -seconds $waitSeconds 
    echo ""
}



-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/370f17b2-3bd2-4de5-9bc1-3ef63da8a723%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to