Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Free Trial

Alteryx Designer Desktop Discussions

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

Add CreationTime data from Directory input as a column within each individual file

Rachael_OS
8 - Asteroid

Hi folks,

 

Apologies in advance if this is an obvious one, my brain is a small bit fried. 

 

I have a directory of similarly named files (think bookings.csv), and I want to do one or both of the following:

 

1. Add a column within each of the files in the Directory showing the creation time for that specific file so that I can use this information to differentiate age of records within a larger input of all of the files.

 

2. Rename each of the files within the Directory with its individual Creation time (for same reasons as above). 

 

I've had a go at doing this using Dynamic Input, formula tool, append...........I'm just not getting the right outcome. 

 

Can someone point me in the right direction?

 

If it's useful, the reason I want to do this is to take the latest information for each customer booking across all the files. These are .csv files exported weekly from an in-house system by someone else, and I need to use it to create an overall picture of bookings over a specified period of months. I can't unfortunately just use the latest file, as when bookings are completed, they get removed from the system prior to export.

 

Thanks in advance! 

6 REPLIES 6
pankajk
10 - Fireball

Can you not use the 'Directory' tool on the folder where you have all the files? The Directory tool provide lots of attributes on the files like:

    File name, Directory, Creation time, Last Access time, Size, etc.

Please provide more clarity if this is a tool you can't use or have used and not had success OR if the problem is something else.

pankajk_0-1592771892460.png

 

Rachael_OS
8 - Asteroid

Thanks for the quick response! I'm not sure if I'm just being stupid, but I want to take the Creation Time column from the Directory Input and add the creation time for each file as a field within that specific file.

 

e.g. for bookings1.csv, I would want to add the CreationTime for bookings1.csv as a field within bookings1.csv.

pankajk
10 - Fireball

Absolutely doable - when you are reading the file, check the option "Output file name as field";  bring the directory tool and get the 'Creation date' and 'fullpath' and join the 'filename' from input file to 'fullpath' from directory tool and you have the data with creation date.  High level screen shot and output:

pankajk_1-1592773047319.png

 

 

pankajk_2-1592773099962.png

 

pankajk
10 - Fireball

Any questions pls post else would recommend you mark this answer as 'solved' as more people can refer back to this solution in future 🙂

Rachael_OS
8 - Asteroid

Thanks a mill, appreciate it - was definitely overcomplicating things for myself! 

pankajk
10 - Fireball

Agreed, sometimes I just step away and get some fresh air! Glad it worked for you

Labels
Top Solution Authors