Thanks McUsr and I hear you loud and clear on the Windows XP nonsense!
Are you able to answer my question about adding the subfolders?
Any help will be greatly received!!
Cheers,
Mark
Thanks McUsr and I hear you loud and clear on the Windows XP nonsense!
Are you able to answer my question about adding the subfolders?
Any help will be greatly received!!
Cheers,
Mark
Hello.
It would be easier to know that if you showed me what you got.
So go ahead and post it and I will have a look at it.
Best Regards
McUsr
Okay, but donât laugh.
set jobNum to text returned of (display dialog "Enter a job number:" default answer "")
set jobName to text returned of (display dialog "Enter a job name:" default answer "")
set folderpath to POSIX path of (choose folder with prompt "Select client folder")
do shell script "/bin/mkdir -p " & quoted form of folderpath & "/" & quoted form of (jobNum & " - " & jobName) & "/{Admin/{Brief,Misc},'Costings & Proposals'/{Previous Estimates},'Distribution','Official Documents',Print/{Print Specs},Schedule/{Previous Schedules},'Studio'/{PDFs,Images},'Text & Amends'/{Text,Amends,Ancillary Documents}}"
Youâre laughing arenât you!
Mark
In the mkdir solution you can add subfolders using this syntax
do shell script "mkdir -p /path/to/mainFolder/{sub1,sub2/{sub21,sub22/sub221},sub3}
spaces and special characters must be quoted or escaped
The result is:
mainFolder
sub1
sub2
sub21
sub22
sub221
sub3
not at all, quote all terms which contain spaces and remove the braces {} round single elements like Previous Schedules
Stefan,
I think Iâve got it!
Thank you both for your patience!
Mark
Hello.
Just in case you donât know what quoting is: no offense!
set demostring to "this\\ is\\ a quoted\\ string!"
Here the backslashes would supress the shellâs interpretation of the spaces as regular spaces.
You can also use a backslash for supressing other special characters like * (star) for instance.
[b]Edit:[/b ]As Stefan remarked: the backslash is a special character too, so in order to have it work as an escaping
character you have to escape it as well, to make it work as an escaping character.
Sometimes when a long string is to be quoted on can quote the whole string with tickmarks, (straight ones) like this:
set demostring to "'This is a quoted string within single ticks'"
I did change the code for you, hopes it works sure that would unnecessary but just in case.
set jobNum to text returned of (display dialog "Enter a job number:" default answer "")
set jobName to text returned of (display dialog "Enter a job name:" default answer "")
set folderpath to POSIX path of (choose folder with prompt "Select client folder")
do shell script "/bin/mkdir -p " & quoted form of folderpath & "/" & quoted form of (jobNum & " - " & jobName) & "/{Admin/{Brief,Misc},'Costings & Proposals'/'Previous Estimates','Distribution','Official Documents',Print/'Print Specs',Schedule/'Previous Schedules','Studio'/{PDFs,Images},'Text & Amends'/{Text,Amends,'Ancillary Documents'}}"
Hopes this helps
Best Regards
McUsr
in AppleScript your syntax wonât compile because you have to escape the backslash, too
set demostring to "this\\ is\\ a\\ quoted\\ string!"
.
Iâm sorry for that one Stefan. Iâll go back an change it.
I didnât really think it to run, I just wanted to demonstrate what it was.
Best Regards
McUsr