Skip to main content
Solved

File created date

  • March 13, 2023
  • 6 replies
  • 1504 views

Forum|alt.badge.img+3

How to get file creation date and time using AA 360

Best answer by JLogan3o13

@RPA Guy Unfortunately this has been a long-standing problem; why the native File package does not include these most basic Actions is beyond me. I have been submitting tickets for some time to get it added, but so far crickets.

Just out of curiosity, are you looking specifically for the (creation/modified/etc.) date? Or are you trying to do something like capture the most recent file? There are different paths you can follow depending on the desired outcome, but they’re both kind of ugly:

Finding the Date Itself:

Finding a recently created or modified File:

  • If you’re trying to do something like find the most recently created file, you can do something like this without installing anything extra:
  • Loop through files in a folder:
  • Set an If condition, checking for the file Created or Modified date. Beating the dead horse, the action is obviously obtaining the file info in the background; it just doesn’t expose it for our use.

  • Unfortunately, you have to give it a time frame. The one benefit is, if you are creating/modifying the file in your bot, you can use the “Relative to runtime” to narrow the timeframe down:

  • Then perform whichever actions you would like on the file.

As I said, neither option is perfect, but hope that helps anyone who wanders by on this topic.

6 replies

Raul Jaimes
Forum|alt.badge.img+9
  • Navigator | Tier 3
  • March 13, 2023

Hi @lathab 

Use the package File and Folder Attributes Package.

https://botstore.automationanywhere.com/bot/file-and-folder-attributes-package

Let us know your feedback

Regards


Patrik.Wenthe
Forum|alt.badge.img+4
  • Cadet | Tier 2
  • October 15, 2024

The link does not work anymore, nor can I find the file and folder attribute package in the bot store. 

Why is it gone? What are people doing now to identify the attributes of files and folders?

 

I’m trying to get the creation date of a file.


Forum|alt.badge.img+17
  • Most Valuable Pathfinder
  • Answer
  • October 15, 2024

@RPA Guy Unfortunately this has been a long-standing problem; why the native File package does not include these most basic Actions is beyond me. I have been submitting tickets for some time to get it added, but so far crickets.

Just out of curiosity, are you looking specifically for the (creation/modified/etc.) date? Or are you trying to do something like capture the most recent file? There are different paths you can follow depending on the desired outcome, but they’re both kind of ugly:

Finding the Date Itself:

Finding a recently created or modified File:

  • If you’re trying to do something like find the most recently created file, you can do something like this without installing anything extra:
  • Loop through files in a folder:
  • Set an If condition, checking for the file Created or Modified date. Beating the dead horse, the action is obviously obtaining the file info in the background; it just doesn’t expose it for our use.

  • Unfortunately, you have to give it a time frame. The one benefit is, if you are creating/modifying the file in your bot, you can use the “Relative to runtime” to narrow the timeframe down:

  • Then perform whichever actions you would like on the file.

As I said, neither option is perfect, but hope that helps anyone who wanders by on this topic.


Patrik.Wenthe
Forum|alt.badge.img+4
  • Cadet | Tier 2
  • October 15, 2024

JLogan3o13 thank you so much for all these details. I was trying to clean up error screen shots whenever my error recording bot gets triggered. 

So the if  file date condition was super helpful; didn't know that was an option. I set a global value for retention days, capture todays day and then subtract the retention value and verify that the created date is before the date.

It is just not optimal, as you said. Why is the date that I have to compare against in the If statement a string? It doesn't make sense and complicates the whole thing. Maybe that's because I’m new or maybe that's just the way it is…

I see a lot of AA packages and videos and which more of these features would be integrated natively. Would simplify some of the learning curve for sure.

Thanks again!


Aaron.Gleason
Automation Anywhere Team
Forum|alt.badge.img+14
  • Automation Anywhere Team
  • October 18, 2024

Python has a number of ways to do this, but it requires that Python is installed on your bot dev system and your bot runners (in an Enterprise environment).

For clarity, here is the Python code:

import os, time
def getFileCreationDate(filePath):
ctime = os.path.getctime(filePath)
return time.ctime(ctime)

 


Patrik.Wenthe
Forum|alt.badge.img+4
  • Cadet | Tier 2
  • October 21, 2024

@Aaron.Gleason thank you for the help. I already have python installed so definitely something I will be using in the future! Thank you