That's a little trickier. You can use SUBSTRING_INDEX() to split a string
on the Nth '/', but N will vary with path length. With N = -1, though,
we'll get the piece after the last '/' (the filename). Then we could
replace that with nothing in the original string. That is, something like
I have a column that holds hard disk file location info such as:
/Volumes/External HD/aFolder/aFile.pdf
/Volumes/External HD/aFolder/anotherFile.pdf
etc. . . (many files located in the same folder)
Can anyone suggest a single statement (or multiple) that would update every
file location located
You can use the replace string function:
update table set
file_path=replace(file_path,'aFolder','aFolder/aChildFolder');
In each update aFolder will be replaced by the new path.
John Mistler wrote:
I have a column that holds hard disk file location info such as:
/Volumes/External
Wow! That works. Thanks a bunch! While we're at it, I have one more
hang-up:
Is there a (DISTINCT?) statement that will select the distinct folder
path(s) of every entry in the table?
For instance, if I have three files:
/Volumes/External HD/aFolder/aFile.pdf
/Volumes/External