Jump to content

Rename file with file action trigger


Recommended Posts

Trying to create a file action trigger to rename a file by removing a suffix completely. I'm not sure how to share the actual workflow. Attach files does not permit me to upload the workflow.

 

The filename is of the form "/Users/jeremycherfas/Dropbox/jcn-logs/forno-logs/access.log.2022-04-03" {var:filename} is set to {query}

 

I use a regex to remove the final part and copy the result "/Users/jeremycherfas/Dropbox/jcn-logs/forno-logs/access.log" to the clipboard.

 

I pass the clipboard to Run Script bin/zsh containing mv "{var:filename}" "{clipboard}"

 

I get an error "No such file or directory"

 

I'm sure this is something silly, but I cannot figure it out.

 

Debug output:

```

[20:54:36.938] Remove date[File Action] Processing complete
[20:54:36.944] Remove date[File Action] Passing output '/Users/jeremycherfas/Dropbox/jcn-logs/forno-logs/access.log.2022-04-03' to Replace
[20:54:36.945] Remove date[Replace] Processing complete
[20:54:36.946] Remove date[Replace] Passing output '/Users/jeremycherfas/Dropbox/jcn-logs/forno-logs/access.log' to Copy to Clipboard
[20:54:36.946] Remove date[Copy to Clipboard] Processing complete
[20:54:36.947] Remove date[Copy to Clipboard] Passing output '/Users/jeremycherfas/Dropbox/jcn-logs/forno-logs/access.log' to Run Script
[20:54:36.961] ERROR: Remove date[Run Script] mv: rename {var:filename} to {clipboard}: No such file or directory
[20:54:36.966] Remove date[Run Script] Processing complete
[20:54:36.967] Remove date[Run Script] Passing output '' to Debug
[20:54:36.967] Remove date[Debug] '', {
  filename = "{query}"

```

Link to comment
51 minutes ago, jeremycherfas said:

I pass the clipboard to Run Script bin/zsh containing mv "{var:filename}" "{clipboard}"

 

There’s your problem. Variables are fed into Zsh as environment variables. The working equivalent would be mv "${filename}" "$(pbpaste)".

 

1 hour ago, jeremycherfas said:

I'm not sure how to share the actual workflow.

 

You can use a temporary file hosting service like https://transfer.sh.

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...