https://github.com/hammy275/python-movefile-restart
A Python library to allow the moving, deleting, and renaming of files during a Windows restart.
https://github.com/hammy275/python-movefile-restart
deletefile movefile python windows-restart
Last synced: 4 months ago
JSON representation
A Python library to allow the moving, deleting, and renaming of files during a Windows restart.
- Host: GitHub
- URL: https://github.com/hammy275/python-movefile-restart
- Owner: hammy275
- License: mit
- Created: 2020-11-29T21:47:23.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-12-08T01:37:30.000Z (over 5 years ago)
- Last Synced: 2025-12-16T14:52:47.725Z (7 months ago)
- Topics: deletefile, movefile, python, windows-restart
- Language: Python
- Homepage: https://pypi.org/project/movefile-restart/
- Size: 13.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# python-movefile-restart
A small library to move, delete, and rename files at Windows restart time.
## Installation
`pip install movefile-restart` or `pip3 install movefile-restart`, depending on your configuration of Python and Pip.
## Usage
To import, use `import movefile_restart`
From there, you have a couple functions at your disposal:
`movefile_restart.DeleteFile(file_path, check_conflicts=True)`: Queues `file_path` for deletion.*
`movefile_restart.MoveFile(from_path, to_path, check_conflicts=True)` or `movefile_restart.RenameFile(from_path, to_path)`: Moves the file from `from_path` to `to_path`.*
`movefile_restart.GetFileOperations()`: Get a list of tuples containing the source and destination of all file movings queued.
`movefile_restart.PrintFileOperations()`: Print a list of file operations that are scheduled to occur during reboot.
`movefile_restart.RemoveFileOperation(file_op_index)`: Remove a file operation based on its index from `movefile_restart.GetFileOperations()`.
`movefile_restart.CheckPermissions()`: Check for read/write permissions to the registry keys needed for this library.
*: For both of these functions, the `check_conflicts` parameter determines whether or not to perform checks when moving/deleting to make sure if it can be performed successfully in the case of a conflict. It only checks if there is initially a problem (the file being deleted doesn't exist, the source of the file being moved doesn't exist, or the destination file of a move already exists). Setting `check_conflicts` to False when calling these functions will skip all of these checks.
## Current Limitations
* Due to using the Windows Registry for handling these kinds of operations, no other operating system is supported, nor is there planned support.
* Some cases can occur where a move/delete can fail. For example, queueing a deletion of file A then queueing a move from file A to file B isn't currently checked for, and will result in the move not occuring (as file A will be deleted before it can be moved).