I have a folder and inside this folder there's a bunch of subfolders. Using AppleScript I wish to store the pathnames of these subfolders into an array.
Here's my problem: each pathname containing " " (spaces), I want to replace with pathnames containing UNIX-friendly "\ " notation (backslash followed by a space; as in /my/fancy\ path/).
As you can see, I'm only half-way through my goal here. I've spent a good night's worth of laborious attempts, fooling around with replace_chars subroutines, do shell script-with-sed combos and who knows what. No dice.
tell application "Finder"
set myRepos to name of folders of folder ("/Users/hced/Dropbox/GitHub/" as POSIX file)
--> {"320andup", "Baseline.js (jQuery & vanilla JS version)", "Bootstrap (HTML, CSS, and JS toolkit from Twitter)", "Chirp.js (Tweets on your website, simply)", "Coordino"}
end tell
Edit: a valid path example would be /Users/hced/Dropbox/GitHub/A\ folder\ named\ with\ spaces
git fetchin all of the repos. Brutal, yes, but I didn't find a way of doing it within GitHub.app (Mac), and all the projects are just things I'm not touching (forking) myself, I just want the newest of everything. The choice of AppleScript in this case is because I will store the contents of myRepos as variable in Keyboard Maestro... Sounds like a mess? Indeed, but there's the story. – hced Nov 14 '12 at 17:23