find out excel file modified date

  • Hello Friends

    I need to find out excel filet modified date. my task is that based on modification date = todaydate then i have to execute the task.

    i am using SSIS scripting and mail notifications.

    Thanks in advance

    Nitin

  • nitin.lokhande (6/27/2012)


    Hello Friends

    I need to find out excel filet modified date. my task is that based on modification date = todaydate then i have to execute the task.

    i am using SSIS scripting and mail notifications.

    Thanks in advance

    Nitin

    Hi,

    Only one file?

    I would use the execute process task in the control flow that calls a simple powershell script something like this.

    $d1 = Get-date

    $filepath = Get-ChildItem C:\files\whatever.xls

    $d2 = (Get-ItemProperty -Path $filepath).Lastwritetime

    if($d1.date -eq $d2.date)

    {Exit 0}

    else

    {Exit 999}

    Based on the exit codes you can preceed eg. if it is 0 then success precedence constraint otherwise failure.

  • DECLARE @PathFile nvarchar(256)

    CREATE TABLE #FileDetails (

    [Alrernate Name] sysname NULL,

    [Size] bigint,

    [Creation Date] char(8),

    [Creation Time] char(6),

    [Last Written Date] char(8),

    [Last Written Time] char(6),

    [Last Accessed Date] char(8),

    [Last Accessed Time] char(6),

    [Attributes] int NULL

    )

    INSERT INTO #FileDetails

    exec master..xp_getfiledetails @PathFile

    _____________
    Code for TallyGenerator

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply