none
Script to update folder content based on a rev file RRS feed

  • Question

  • Hey, I'm trying to figure out how to get PS to update a folder's content if the rev file on the remote share is different.

    Here' s the basic logic:

    1. Get current rev (from a text file called Rev #.txt, where # is the number). 

    2. Get new rev from a remote share (\\sharename\Rev #.txt)

    3. If rev on the remote share is newer, copy the content from the remote share to the current folder.

    4. Done.

    Any help is much appreciated. Thanks!

    Wednesday, February 19, 2014 8:17 PM

Answers

All replies

  • In general, I recommend using robocopy. By default it copies only newer files from a source to a destination path.

    Bill

    Wednesday, February 19, 2014 8:31 PM
    Moderator
  • Yeah, I thought about that. However, I need the rev number in order to spit it back to my network monitoring program. Also, I want to control when it actually performs a copy vs it automatically doing the copy. If I change the rev, it'll let the script know to copy over the updates.
    Wednesday, February 19, 2014 8:51 PM
  • So what's your specific question, then?

    Bill

    Wednesday, February 19, 2014 8:57 PM
    Moderator
  • Do not put a number in the file name. 

    Use the file date to test if newer then use xcopy or, better yet, replace.  Many are trying to do this. Technically, the use of a new file name based on rev is a bad idea. It runs counter to all tools and methods.  Don't re-invent the wheel.  Stick to proven practices.


    ¯\_(ツ)_/¯

    Wednesday, February 19, 2014 9:52 PM