1

I wrote ant script to get latest modified files from vss.

<target name="prepare">
    <vssget localPath="C:\build"
            date="11/16/2011"
            recursive="true"
            login="ss,ss"
            vsspath="$\PIS" filetimestamp="modified"/>
</target>

If I am executing above ant script, I getting all the files from vss. I need files based on given the date. Please help me.

Alex K
  • 22,315
  • 19
  • 108
  • 236
Suri
  • 17
  • 2

1 Answers1

0

As you can see from this source code of org.apache.tools.ant.taskdefs.optional.vss.MSVSSGET class:

/**
 * Builds a command line to execute ss.
 * @return     The constructed commandline.
 */
Commandline buildCmdLine() {
    Commandline commandLine = new Commandline();

    // build the command line from what we got the format is
    // ss Get VSS items [-G] [-H] [-I-] [-N] [-O] [-R] [-V] [-W] [-Y] [-?]
    // as specified in the SS.EXE help
    commandLine.setExecutable(getSSCommand());
    commandLine.createArgument().setValue(COMMAND_GET);

    if (getVsspath() == null) {
        throw new BuildException("vsspath attribute must be set!", getLocation());
    }
    commandLine.createArgument().setValue(getVsspath());

    // -GL
    commandLine.createArgument().setValue(getLocalpath());
    // -I- or -I-Y or -I-N
    commandLine.createArgument().setValue(getAutoresponse());
    // -O-
    commandLine.createArgument().setValue(getQuiet());
    // -R
    commandLine.createArgument().setValue(getRecursive());
    // -V
    commandLine.createArgument().setValue(getVersionDateLabel());
    // -W
    commandLine.createArgument().setValue(getWritable());
    // -Y
    commandLine.createArgument().setValue(getLogin());
    // -G
    commandLine.createArgument().setValue(getFileTimeStamp());
    // -GWS or -GWR
    commandLine.createArgument().setValue(getWritableFiles());

    return commandLine;
}

and org.apache.tools.ant.taskdefs.optional.vss.MSVSS class:

/**
 * Gets the version string. Returns the first specified of version "-V1.0",
 * date "-Vd01.01.01", label "-Vlbuild1".
 * @return An empty string if a version, date and label are not set.
 */
protected String getVersionDateLabel() {
    String versionDateLabel = "";
    if (version != null) {
        versionDateLabel = FLAG_VERSION + version;
    } else if (date != null) {
        versionDateLabel = FLAG_VERSION_DATE + date;
    } else {
        // Use getShortLabel() so labels longer then 30 char are truncated
        // and the user is warned
        String shortLabel = getShortLabel();
        if (shortLabel != null && !shortLabel.equals("")) {
            versionDateLabel = FLAG_VERSION_LABEL + shortLabel;
        }
    }
    return versionDateLabel;
}

you should set date attribute of vssget task.

Try to set date attribute's value in different formats (MM/dd/yy;hh:mma, mm/dd/yyyy;h:mma or dd.mm.yyyy). This article and this post can help you to find the correct format.

The correct date time format, IMHO, depends on regional settings of VSS database. This issue post is about solving a similar problem.

Community
  • 1
  • 1
Alex K
  • 22,315
  • 19
  • 108
  • 236