In CF9, I have a string like C:\Docs\472837\nyspflsys\Medical Report\XLSX_46.xlsx
I want to split it by last backward slash, so it should look likearray[1] = C:\Docs\472837\nyspflsys\Medical Report
andarray[2] = XLSX_46.xlsx
How to do it in ColdFusion 9 ?
You may want to consider using GetDirectoryFromPath and GetFileFromPath.
<cfset fullPath = "C:\Docs\472837\nyspflsys\Medical Report\XLSX_46.xlsx">
<cfset dirPath = getDirectoryFromPath(fullPath)> <!--- C:\Docs\472837\nyspflsys\Medical Report\ --->
<cfset dirPath = reReplace(dirPath, "[\\/]$", "")> <!--- C:\Docs\472837\nyspflsys\Medical Report --->
<cfset fileName = getFileFromPath(fullPath)> <!--- XLSX_46.xlsx --->
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With