Move your file with the filename

This rules watches for any files with this pattern @Var1--Var2 and immediately use a python script to move the file.
Var1 is the destination path and Var2 is the filename.
Example: You rename the file like this @Documents-Serie-GOT--ep1.mkv then the script move the file in /Users/user1/Documents/Serie/GOT
RULES:
File FunctionMove.py
Var1 is the destination path and Var2 is the filename.
Example: You rename the file like this @Documents-Serie-GOT--ep1.mkv then the script move the file in /Users/user1/Documents/Serie/GOT
RULES:
If ALL of the following conditions are met
Name matches @ ... -- ...
Do
Run shell script FunctionMove.py
File FunctionMove.py
- Code: Select all
#!/usr/bin/python
import sys,os
import shutil
g=str(sys.argv[1])
name= g.split("@")[1].split('--')
homepath="/Users/user1/"
path= homepath+name[0].replace('-','/')
if os.path.exists(path):
file=path+'/'+name[1]
if not os.path.isfile(file):
shutil.move(g,file)