2
set source to (choose folder default location ("~/Desktop/") with multiple selections allowed)
repeat with filetocopy in source
    set n to (quoted form of (POSIX path of filetocopy)) & " "
    set dir to do shell script "dirname " & n
    set bn to do shell script "basename " & n
    set n2 to "." & bn
    set n3 to dir & "/" & n2
    do shell script "mv " & n & space & quoted form of n3
end repeat
display dialog "Folders Hidden!" buttons {"OK"} default button 1

It refuses to make ~/ into an alias. However, I can't hard-code the path with my username as I am releasing this for friends. Any simple solutions?

200_success
  • 7,286
  • 1
  • 43
  • 74
Recon
  • 608
  • 9
  • 18
  • possible duplicate of [Relative file paths with Applescript](http://stackoverflow.com/questions/24152552/relative-file-paths-with-applescript) – 200_success Jun 09 '15 at 05:00
  • @200_success thanks! Will try this out. – Recon Jun 09 '15 at 05:22
  • http://stackoverflow.com/questions/30778426/expand-a-posix-path-with-prefix-using-applescript –  Jun 11 '15 at 10:37

1 Answers1

1

You don't need the ~/. Use (Path to desktop) instead.

set source to (choose folder default location (path to desktop) with multiple selections allowed)
Nick Groeneveld
  • 895
  • 6
  • 18