zoff28 Posted June 23, 2020 Posted June 23, 2020 Hi People, I'm super new to this thing so pardon me for basic newbie question, i tried to make automation utilizing the mv commands with osascript in Alfred's script action It works in AppleScript but not here. I've tried using the backslash, single quote, double quote (as seen in many cases here or in Stack Overflow) but it still not works for me. It looks like this: it gives me error like this:ERROR: Move Item[Run Script] 396:443: execution error: sh: mv /Users/*****/Downloads/FileName.pdf /Users/******/Documents/*****/FileName.pdf: No such file or directory (127) if i delete the single quote, it gives me error like this: ERROR: Move Item[Run Script] 394:434: execution error: usage: mv [-f | -i | -n] [-v] source target mv [-f | -i | -n] [-v] source ... directory (64) anyone have experience with this problem? any help regarding this problem is really appreciated
zoff28 Posted June 24, 2020 Author Posted June 24, 2020 apparently, i tried using the single quote in apple script but it not works too so i delete it Then it works again in apple script run but give the second type of error in alfred (as shown in the post)
deanishe Posted June 25, 2020 Posted June 25, 2020 do shell script "mv " & quoted form of SourcePath & " " & quoted form of DestinationPath & "/" & quoted form of Filename In future, if you have a question regarding some code, post the code, not an image of it. Better yes, upload the whole workflow somewhere and post a link. If the error isn't obvious (as it is here), you're requiring us to re-create your script/workflow in order to be able to run it. That's not reasonable, and few people would even bother. So help us to help you by making it as easy as possible for us to see the error for ourselves.
zoff28 Posted June 26, 2020 Author Posted June 26, 2020 ah i see.. sorry for the trouble, i'll keep in mind in the future I tried this too but it still won't fix it, and then i found the problem (i think if i upload the full work like you instruct it will be easier, my bad sorry) It's about the file path: if there is a folder where there is space in it's name, the mv command won't work if i don't single quote the name. For example: Users/MyName/Dummy Folder/Sample File.png It won't work unless i change it to Users/MyName/'DummyFolder'/'Sample File'.png and when we do File Filter action in Alfred, it gives path output without the single quote so.. it need something so i google sample text handling and configure how to get this done I'll post this workflow if anyone interested in this (might just build it from scratch tho except you're really new to this like me hahaha) Thanks for your help deanishe
deanishe Posted June 26, 2020 Posted June 26, 2020 (edited) No, what I wrote is kinda correct: you just need to use “quoted form of”, which will add the necessary quotes for you. But I messed up the command above (which is what happens when you don’t have the workflow/code to actually test it). Try: do shell script "mv " & quoted form of SourcePath & " " & quoted form of (DestinationPath & "/" & Filename) Edited June 26, 2020 by deanishe
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now