Home Forums Data Warehousing Integration Services Looking for a way to move files from a dynamic source location to another dynamic archive location RE: Looking for a way to move files from a dynamic source location to another dynamic archive location

  • OK so how did I do it, this is a simple step-by-step

    1)Load Input folder to variable use execute sql task (User::FileLocation)

    2)Load Archive folder to variable use execute sql task (User::ArchiveLocation)

    3)Fill a source path variable withe the following expression

    @[User::FileLocation] + "\\"

    4)

    @[User::ArchiveLocation] + "\\"

    5)When using 'For each file loop' use script task to get filname

    Dts.Variables("FL").Value = System.IO.Path.GetFileName(Dts.Variables("CSVFileName").Value.ToString())

    Dts.TaskResult = ScriptResults.Success

    User::FL is write variable,while User::CSVFileName is read-only (User::CSVFilename is the variable on which index 0 of the 'For Each File' task is mapped).

    6)Fill a variable User::MyFileValue with expression@[User::FL]

    7)Fill a full source path variable using the following expression

    @[User::SourcePath] + @[User::MyFileValue]

    8)Fill a full archive path variable using the following expression

    @[User::ArchivePath] + @[User::MyFileValue]

    9)Use a file system task 'Rename file' with 'full source path' a source and 'full archive path' as destination

    There are definitely corners to cut here but this works.