Alteryx Designer Desktop Discussions

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

Check if the folder name is present or not

Sshasnk
8 - Asteroid

I get multiple file paths from different directory tools now I have to segregate based on the folder name

 

FilePath
C:\program\ABC\lmnop.xlsx
C:\program\mnop.xlsx
C:\program\ABC.xlsx

 

1. Take the file name and keep it in a separate column (name: filename)

2. Check if the last folder is ABC or not (using filter)

3 REPLIES 3
Christina_H
14 - Magnetar

Check out the File functions: File Functions | Alteryx Help

 

In your case you can use FileGetFileName to get the file name.  For the folder you could use FileGetDir but that returns the whole file path excluding only the filename and extension, so you would need to do more if you just need the final folder.  I used this RegEx formula instead:

REGEX_Replace([FilePath], '.*\\(.+)\\[^\\]+', '$1')

Christina_H_0-1664354771831.png

 

DataNath
17 - Castor

@Sshasnk I'd first split out the two parts with the following expressions:

 

DataNath_0-1664354771903.png

 

Then for tackling the Directory filter, just check if it ends with \ABC\ like so:

 

DataNath_1-1664354798625.png

binuacs
20 - Arcturus

@Sshasnk One way of doing this

 

binuacs_0-1664355155073.png

 

Labels