How to delete files in Azure file share older than certain day (this case 1 day)

Anonymous
2022-12-06T21:41:37.503+00:00

I am trying to delete csv files in Azure file share that is older than 1 day (for now).

Currently, I am only testing at Metadata to see the results before adding next object (actual Delete) portion.

267933-image.png

I have files that appears to be older than 1 day (as of now), but when I run it, it did not generate any output.

How do I write expression?

I am not clear how to express on Start time and End time.

BTW, I am going by the this time stamp (Last Modified) of csv files:

267878-image.png

Thanks.

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
{count} votes

1 answer

Sort by: Most helpful
  1. AnnuKumari-MSFT 34,566 Reputation points Microsoft Employee Moderator
    2022-12-07T14:33:57.717+00:00

    Hi @Anonymous ,

    Thankyou for using Microsoft Q&A platform and thanks for posting your question here.

    As I understand your query, you are trying to look for the suitable expression in order to delete the files which has been modified in the range of a certain time period.

    The expression you are using is perfectly correct. However, here you need to consider the time zone you are present at. The lastmodified timestamp in ADLS is showing the data in accordance with your current timezone. However, in expression you are using @utcnow() function .

    Try considering your timezone by adding or subtracting the hours you are ahead or behind the utc time zone.
    For Example : If your timezone is IST, try using the expression as :

    starttime: @adddays(addhours(addminutes(utcnow(),30),5),-2)
    endtime: @adddays(addhours(addminutes(utcnow(),30),5),-1)

    Hope this will help. Please let us know if any further queries.

    ------------------------------

    • Please don't forget to click on 130616-image.png or upvote 130671-image.png button and take satisfaction survey whenever the information provided helps you.
      Original posters help the community find answers faster by identifying the correct answer. Here is how
    • Want a reminder to come back and check responses? Here is how to subscribe to a notification
    • If you are interested in joining the VM program and help shape the future of Q&A: Here is how you can be part of Q&A Volunteer Moderators
    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.