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.

 

Link to comment
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"

Link to comment

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
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...