Hi everyone,
I’m here again with my UNIX question on MacScripter instead of some UNIX forum :rolleyes:
Yesterday I had some problems with moving files containing characters like ', $ etc.
That was because I used this kind of script:
do shell script "mv '" & SourceFile & "' '" & DestinationFolder
Which is the same as this script but only shorter:
do shell script "mv " & quoted form of SourceFile & " " & quoted form of DetinationFolder
These 2 scripts both have single quotes ( ’ ), using double quotes ( " ) allows you to move more files…
I tested:
set NotWorking to {}
repeat with i in {"\"", "'", "*", "$", "€", "%", "&", "é", "è", "!", "ç", "à ", "?", "-", "_", "(", ")", "=", "+"}
try
do shell script "mkdir \"/My" & i & "s Folder\""
on error
set end of NotWorking to i as text
end try
end repeat
NotWorking
It gave an error while I tried to make a folder containing a " , (or in AppleScript, escaped by a \ → ")
And a * in the file name didn’t gave an error but created a space instead of the *.
Are there work arounds? Are there (dis)advantages of using double quotes instead of single ones? And last but not least, are there other characters that will conflict ? (like the " ) when using double quotes?
I have to move them with shell script, no way I’ll use Finder to move files…
Thanks in advance