Conditional File Copying

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Guest's Avatar

    Conditional File Copying

    I am still new to BC, and already like it quite a bit. I have a project where I need to compare several thousand web pages between two locations. I am trying to automate my task. I am trying to figure out how to copy files from the first location that pass the rules I've writtem to second location but with a condition. If a file is being worked on by web page author (filename.html), there will be a corresponding lock file (filename.lck) in the directory. If that lock file is there, I don't want to copy the file over because I could be overwriting new work. Can this be scripted? Will it take a combination of batch file and BC scripting to accomplish?

    And while I am thinking of it, can the actions taken and/or comparison results be recorded, or is that something I should considering doing from a batch file too?

    InQ
  • Chris
    Team Scooter
    • Oct 2007
    • 5538

    #2
    Re: Conditional File Copying

    It isn't possible to do this entirely in a BC script. You'll need to use a batch file or other scripting language to grab the list of locked files, then you can pass the list of locked file names to a BC script as a filter so those files are ignored.

    To use command line arguments in BC2 scripts, use %1, %2, through %9.

    To pass a filter on the command line, call the script using:
    bc2.exe @script.txt "-foo.*;-bar.*"

    And in your script use the command:
    filter %1
    to ignore those files.

    Addition:
    To capture a log of the BC script, use the scripting command:
    log verbose c:\logfile.txt

    To generate a report, use the file-report or folder-report command.

    Documentation on BC's scripting capabilities is in the Command Line & Scripting section of the help file.
    Chris K Scooter Software

    Comment

    Working...