Olivier,
Here is a simple script that will check to see if a file exists and if it does exist it will copy it to another folder. Note: The account that Workflow is running under must have permissions to create the new target folder and copy a file to that new folder.
The script is expecting tokens that define the SourceFileName, SourceFolder, and TargetFolder. It returns a token called FileExists that you can evaluate in a Conditional Sequence activity.
namespace WorkflowActivity.Scripting.Script
{
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Text;
using System.IO;
/// <summary>
/// Provides one or more methods that can be run when the workflow scripting activity is performed.
/// </summary>
public class Script1 : ScriptClass90
{
/// <summary>
/// This method is run when the activity is performed.
/// </summary>
protected override void Execute()
{
// Get the token values for source filename, source path, and target path...
String sourcePath = this.GetTokenValue("SourcePath").ToString();
String sourceFileName = this.GetTokenValue("SourceFileName").ToString();
String targetPath = this.GetTokenValue("TargetPath").ToString();
String sourcePathAndName = Path.Combine(sourcePath, sourceFileName);
String targetPathAndName = Path.Combine(targetPath, sourceFileName);
Boolean fileExists = false;
try
{
// Check to see if the source file exists...
if (File.Exists(sourcePathAndName))
{
fileExists = true;
// Check to see if the target path exists. If not then create it...
if (Directory.Exists(targetPath) == false)
{
Directory.CreateDirectory(targetPath);
}
// Copy the souorce file to the target directory...
File.Copy(sourcePathAndName, targetPathAndName, true);
}
}
catch (System.Exception e)
{
this.WorkflowApi.TrackError(e.Message);
}
// Set the result token for later processing...
this.SetTokenValue("FileExists", fileExists);
}
}
}
Here is a sample workflow;

The tokens containing the file and path info;

And the Conditional Sequence criteria;
