Hi,
I have a Master SS with a column called ‘Full Path’ - along with 3 other columns in this SS I have filtered them and wrote them out into another SS. The next step I need to do is to extract the file name from the end of each of the full paths.
e.g
Input
\home\desktop\joebloggs\banking\Jan\payment.pdf
Output required - \home\desktop\joebloggs\banking\Jan\
My SS had thousands of lines so I need to do this for each row in column ’ Full Path’
Any ideas ?
Gokul001
(Gokul Balaji)
December 2, 2022, 9:34am
2
Hi @Sean_Ryan1
How about this expression
Directory.GetParent("\home\desktop\joebloggs\banking\Jan\payment.pdf")
Regards
Gokul
Gokul001
(Gokul Balaji)
December 2, 2022, 9:35am
3
Hi @Sean_Ryan1
How about this expression
Path.GetDirectoryName("\home\desktop\joebloggs\banking\Jan\payment.pdf")
Regards
Gokul
Hi,
Do I need to put that expression in an assign activity - as I have to do this for thousands of rows and then re print that row with the new output
Hello,
Use Path.GetFilenName() function in which pass your string. so It will return your filename.
Example : -
Path.GetFilenName(“\home\desktop\joebloggs\banking\Jan\payment.pdf”)
Gokul001
(Gokul Balaji)
December 2, 2022, 9:47am
6
Hi @Sean_Ryan1
Use Read Range activity → Store it as DtRead
Use Assign activity
DtClone = DtRead.Clone
DtClone -> Variable Type | System.data.DataTable
use For each row in data Table activity
Inside the For each row in data table activity
Use Assign activity
OutputString = Path.GetDirectoryName(Currentrow("Column Name").Tostring)
Use Add data Row activity and pass the Value
{OutputString}
Note : If you need to add more column add it.
Outside the For each row in data table activity
Use Write Range activity
Regards
Gokul
1 Like