| 1 |
"""Start regedit. Go to HKEY_CLASSES_ROOT. The key we need is *, probably the very first in a long list.
|
| 2 |
If a subdirectory called Shell already exists, enter it, otherwise create it.
|
| 3 |
(Right-click on the *, choose New Key, type "Shell".)
|
| 4 |
|
| 5 |
In Shell, create a new key called "Move up" (or whatever you want to call it).
|
| 6 |
Double-click on the value called "Default", then enter "Move up". Create another key here (a sub-key of "Move up"),
|
| 7 |
called "Command". Double-click the "Default" value and enter something like
|
| 8 |
|
| 9 |
|
| 10 |
c:\python22\python.exe c:\scripts\moveup.py "%1"
|
| 11 |
|
| 12 |
That's it. If all went well, all files should now have an option "Move up" in their context menu.
|
| 13 |
Right-click any file to find out.
|
| 14 |
"""
|
| 15 |
# moveup.py
|
| 16 |
# Moves a file to the parent directory.
|
| 17 |
|
| 18 |
import os
|
| 19 |
import sys
|
| 20 |
import win32api
|
| 21 |
|
| 22 |
path, file = os.path.split(sys.argv[1])
|
| 23 |
parent_dir, dir = os.path.split(path)
|
| 24 |
#o=open(r"c:\test.kpmg",'w')
|
| 25 |
#o.write(path)
|
| 26 |
#o.write(file)
|
| 27 |
#o.close()
|
| 28 |
if parent_dir != path:
|
| 29 |
dest = os.path.join(parent_dir, file)
|
| 30 |
win32api.MoveFile(sys.argv[1], dest) |