0
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
Are you trying to escape the paths to pass back into a shell command? – adayzdone – 2012-11-14T01:42:10.380
adayzdone: yes. I want to iterate over the items in the array via a macro in Keyboard Maestro (it's a bit complicated to explain the full story). Also, some part of the question is just because I'm curious. – Henrik – 2012-11-14T17:10:46.993
Actually – and this is probably not the (or a) recommended way of doing things git-wise, but – my end goal is to parse my GitHub folder for subfolders one level down and then mass-
git fetch
in 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. – Henrik – 2012-11-14T17:23:38.197