Explore Tools
Experts in Microsoft SQL Server Operations, Performance, Migrations, Replication & Cloud

SSIS Create Archive Folder based on current system date & time
by BF (Senior MSSQL Operations - Enterprise, Cloud, Strategy)


Create package variables called ArchivePath and ArchiveFullPath:

ArchivePath will have it's value property set to: \\srv-app01\apps\Input Files Archive\

ArchiveFullPath will have it's properties set to:

EvaluateAsExpression - set this to True

Expression - set this to:
@[User::ArchivePath]+(DT_WSTR,4)YEAR(GETDATE()) + "_"+ RIGHT("0" + (DT_WSTR,2)MONTH(GETDATE()), 2) + "_"+ RIGHT("0" + (DT_WSTR,2)DAY( GETDATE()), 2) + "_"+ RIGHT("0" + (DT_WSTR,2)DATEPART("hh", GETDATE()), 2) + RIGHT("0" + (DT_WSTR,2)DATEPART("mi", GETDATE()), 2)

Configure File System Task to use the ArchiveFullPath package variable

Image #1: