Issues with sed renaming rule

I have a rule to rename PDF files via `sed` and an external text file of fules.
I'm using this embedded script:
This works great for most files, but there are a few folders where it does NOT work and i cannot figure out why.
By not work, I mean it either throws up an error in the log ("[Error] Shell script failed: Error processing shell script on file ...") or the file simply does not get renamed.
The same command DOES work when I run it manually in Terminal, e.g., with $x as the file:
Why would it work in Terminal but not in Hazel?
Is $1 the full path or just the filename?
UPDATE: OK, pretty sure the issue is that $1 is the full path, not just the filename.
So do I need to cd into the folder, then mv just the file?
What's the best way to do that?
I'm using this embedded script:
- Code: Select all
mv -n "$1" "`echo $1 | sed -E -f ~/sedFileThisRename.txt`"
This works great for most files, but there are a few folders where it does NOT work and i cannot figure out why.
By not work, I mean it either throws up an error in the log ("[Error] Shell script failed: Error processing shell script on file ...") or the file simply does not get renamed.
The same command DOES work when I run it manually in Terminal, e.g., with $x as the file:
- Code: Select all
mv "$x" "`echo $x | sed -E -f ~/sedFileThisRename.txt`"
Why would it work in Terminal but not in Hazel?
Is $1 the full path or just the filename?
UPDATE: OK, pretty sure the issue is that $1 is the full path, not just the filename.
So do I need to cd into the folder, then mv just the file?
What's the best way to do that?