Folder with apostrophe problems

Hi all

Use this script (build it with VBA thanks to DJ)

set streamEditorCommand to " | tr [/:] [:/] "
set streamEditorCommand to streamEditorCommand & " | sed -e " & quoted form of (" s.:." & (POSIX file “/” as string) & “.” )
do shell script “find -E ‘/Users/rondebruin/Desktop/Ron’'‘s Folder’ -iregex ‘./[^~][^/]\.(xls|xlsx|xlsm|xlsb)$’ -maxdepth 1” & streamEditorCommand without altering line endings

In this example the name of the folder where I browse to is Ron’s Folder (with a apostrophe)

The script is not working if there is a apostrophe in the folder name and we must add a replace line in VBA to get it correct
ScriptToRun = Replace(ScriptToRun, “‘'’”, “‘\’'”)

So it looks like this

set streamEditorCommand to " | tr [/:] [:/] "
set streamEditorCommand to streamEditorCommand & " | sed -e " & quoted form of (" s.:." & (POSIX file “/” as string) & “.” )
do shell script “find -E ‘/Users/rondebruin/Desktop/Ron’\'‘s Folder’ -iregex ‘./[^~][^/]\.(xls|xlsx|xlsm|xlsb)$’ -maxdepth 1” & streamEditorCommand without altering line endings

Is this the way or is there another way that is better

If you want to see it working with VBA see : http://www.rondebruin.nl/mac/mac013.htm

Thanks

Hi,

use always quoted form of, it takes the best syntax


do shell script "find -E " & quoted form of "/Users/rondebruin/Desktop/Ron's Folder" & " -iregex ..."

Thanks Stefan, will test and reply this evening with my test results.

Before I go I forgot to add this, I create the folder path like this

folderPath = MacScript(“choose folder as string”)

And then this

folderPath = MacScript(“tell text 1 thru -2 of " & Chr(34) & folderPath & _
Chr(34) & " to return quoted form of it’s POSIX Path”)

Thanks, I go now before mu wife kill me