Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have this script:

    #!/bin/sh -x

    /bin/echo "Drag folder into Terminal and hit return ->"
    /usr/bin/read folderLocation

    /bin/cp -R "$folderLocation" /Users/my/Desktop/

And it returns:

+ /bin/cp -R '' /Users/my/Desktop/
cp: fts_open: No such file or directory

Any idea why that is?

Thank you for any insight!

share|improve this question
up vote 0 down vote accepted

I got this to work, on Debian Gnu/Linux:

#!/bin/sh -x

/bin/echo "Drag folder into Terminal and hit return ->"
read folderLocation

eval "cp -R  -t '/home/my/Desktop' $folderLocation"

I dropped the path to read (you may not have to (read is a built in of bash, and can't find it in /usr/bin or /bin)

Important changes are in last line:

  • -t option followed by target directory makes cp more robust.
  • eval is needed because of quotes put around return value by read.

As for why you get '' (empty string from read). I am guessing it is because the drag and drop is not working, this is not a feature of the shell but of the terminal and file manager. What terminal program are you using?

share|improve this answer
I just dropped /usr/bin right before I read this, so thanks for this :) I'm using in OS X, which does support drag-and-drop-to-full-path-display, so I can do it. Thanks for the additional tips! – user1631862 Sep 27 '12 at 21:21

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.