Jump to content

Help with copying file from Downloads to PWD

Recommended Posts

I was developing a simple workflow to copy/move the latest file or folder in Downloads to the current working directory.

I have almost completed the workflow but the Alfred debugger is giving me this error consistently:


": No such file or directory"


Even though the same command works in terminal.


Here is the workflow I have done so far: https://github.com/bhishanpdl/Shared/blob/master/Alfred_questions/aa Copy Last Download to PWD.alfredworkflow?raw=true


How to fix the problem.


What I am trying to do is given below:


# example
# echo "hello" > ~/Downloads/a.txt
# cat ~/Downloads/a.txt
# mkdir -p ~/try\ space   # create a directory with space in it
# cd ~/try\ space
# open .   # this opens the Finder where we want to test our workflow
# command to test:
# /bin/mv ~/Downloads/a.txt ~/try\ space/   # this works in terminal
# but does not work in Alfred.


Share this post

Link to post
18 hours ago, Bhishan said:

Even though the same command works in terminal.


It doesn't because it's not the same command. Check your input more carefully (this is what the Debug utility is for).


echo "$DOWNLOADS/$RECENT" adds a trailing newline, which is what's causing the problem. It should be echo -n "$DOWNLOADS/$RECENT"

Share this post

Link to post

Thanks @deanishe , I had just found the mistake this morning 4 hours after you posted the solution, but without looking the solution.

I was trying to find out why it was not working and did this    echo "$1" "$pwd" > a.sh  and looked inside a.sh,

it showed an unwanted new line was there and I fixed that by changing  echo by echo -n .


Then I checked my Alfred thread, there was the same suggestion already. Thanks anyways.

Edited by Bhishan

Share this post

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...