Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

Pulling File "Content Created" date into Alteryx

jason79121
7 - Meteor

Hi everyone,

 

I am trying to pull in the "Content Created" date into Alteryx as I have a directory of over 30+ files and created a batch macro to avoid schema issues. One thing I need to do is perform trend analysis, in which I need the original day the file was created. At first, I tried using the "Date Created", but noticed that this is showing as the day that I downloaded the files from the internet which is not what I need.

 

Does anyone know if there is a way to get the original Content Created date for files in a directory?

 

jason79121_0-1646149934363.png

 

9 REPLIES 9
atcodedog05
22 - Nova
22 - Nova

Hi @jason79121 

 

Not sure if Alteryx can do it. Maybe we need python snipped integration for this.

TheOC
15 - Aurora
15 - Aurora

hey @jason79121 

After having a look online - i think this would require a bit of Python programming.

That data is not file-system metadata, its metadata of a specific file types header (more here https://stackoverflow.com/questions/51269249/how-to-access-the-content-created-date-rather-than-the-...
https://stackoverflow.com/questions/61242017/how-to-extract-metadata-from-docx-file-using-python )

You would need a library specific for your file, and as far as im aware, its not something build universally into Alteryx.

Hope this helps,
TheOC


Bulien
TheOC
15 - Aurora
15 - Aurora

On that note - do bare in mind the Python tool is built into Alteryx, so you might have joy finding a solution in python, importing it into a tool, and then having that directly within your workflow importing into a dynamic input.

Cheers,
TheOC


Bulien
RolandSchubert
16 - Nebula
16 - Nebula

Hi @jason79121 ,

 

of course it can be done using Python, but I think, a Run Command tool would also help to solve the problem.

2022-03-01_17-14-34.jpg

 

My approach would be to call a .bat (or .cmd) file with a dir command.  
DIR /T:C returns the creation date, you can limit the files using e.g. DIR /T:C *.xlsx to Excel files. The result can be written to a file using DIR /T:C >outputfile. In my sample dir.bat file I also sort the files by creation date.

 

The created file can be loaded using Dynamic Input (Block Until Done to ensure, Run Command is executed first).

 

For each file, the creation date is listed. Unfortunately, a bit of parsing will be needed ...

 

What do you think?

 

Best,

 

Roland

jason79121
7 - Meteor

Hi TheOC, do you happen to have an example workflow of what this might look like in Alteryx once the python output is completed?

 

I will have to do some learning on python as I am not familiar, but having the Alteryx piece ready would be helpful!

TheOC
15 - Aurora
15 - Aurora

hi @jason79121 

All i had in mind was the same as @RolandSchubert . Props for the Run Command tool usage too. I wasn't certain if you would be able to do it that way, knew for certain Python could though.

Cheers,
TheOC


Bulien
jason79121
7 - Meteor

It seems like my company restricts the usage of running a .bat file, so I will be trying to figure out how to run and input Python into my Alteryx Workflow.

jason79121
7 - Meteor

Unfortunately my IT team restricts the running of .bat files on our laptops, so I will be trying to input Python via alteryx into the workflow.

jason79121
7 - Meteor

Hi Roland,

 

I spoke with my Infosec team and got them to approve me running a .cmd file. I had a few questions in your explanation.

 

1. in your dir.bat file, what is the data\list\files? Are these the directory of the files that are being stored in?

2. In looking at the dynamic input in the example you provided, I see that the "Field" is set to "Dir", is this supposed to corresponded with the dir.bat command?

 

I apologize if these are basic questions, I am still new to Alteryx and also in general writing commands.

 

Best,

Jason

Labels