Assuming Windows 7, If you open a folder and type "shell:sendto" in the address bar then hit enter you'll be taken to the context menu. You can add a .cmd file with the following in it.
@echo off
cls
python C:YourFileuploadscript.py %1
This should execute your python script passing in the file (%1) as a parameter. Within the python script you can use:
import sys
sys.argv #sys.argv[1] is the file to upload
This gets all parameters passed in so sys.argv[1]
should get you the file that was passed in. I tested this and it works. The reason you need the .cmd file instead of going right to the .py is because the .py file wont show up in the Send To menu.
More information on getting the file passed in is here:
Accepting File Argument in Python (from Send To context menu)
EDIT: Adding script for calling on multiple files. Note this calls the python script on each individual file, if you want to send all the files as a parameter to the python script then you'll need to do a bit more work. You need to research batch scripting if you want to do more advanced things.
@echo off
cls
:upload_loop
IF "%1"=="" GOTO completed
python C:YourFileuploadscript.py %1
SHIFT
GOTO upload_loop
:completed
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…