This project is a containerized Python script that monitors a specified folder and its subfolders for new files. When new files are detected, they are moved to a destination folder while preserving the original directory structure.
- Monitors a folder and its subfolders for new files.
- Moves newly created files to a destination folder.
- Preserves the directory structure during the move.
- Dockerized application only has access to mapped folders.
- Docker (v20.10 or higher recommended)
- Docker Compose (optional, for easier management)
Pull the latest version of the container to your local machine:
docker pull rcortese/file-mover:latest
Replace <source_folder>
and <destination_folder>
in docker-compose.yml file with the paths you want to monitor and move files to. Run the Docker container using docker-compose:
docker-compose up -d
Alternatively, to run without docker-compose, replace <source_folder>
and <destination_folder>
with the paths you want to monitor and move files to and run:
docker run -d
-v <source_folder>:/source_folder
-v <destination_folder>:/destination_folder
rcortese/file-mover:latest
Once the container is running, it will monitor the source folder for new files and move them to the destination folder as they appear.
To stop the container, use:
docker ps # Get the container ID or name
docker stop <container-id-or-name>
- Source Folder: The directory to be monitored for new files.
- Destination Folder: The directory where files will be moved, preserving the directory structure.
To monitor /data/incoming
and move files to /data/processed
, run:
docker run -d
-v /data/incoming:/source_folder
-v /data/processed:/destination_folder
rcortese/file-mover:latest
-
Ensure Docker is installed and running.
-
Verify that the source and destination folders are correctly mounted and accessible.
-
Check container logs for any errors:
docker logs <container-id-or-name>
-
No files are being moved: Ensure the
source_folder
anddestination_folder
paths are correctly set and that the container has appropriate permissions to access these directories. -
Errors during build: Verify that Docker and Docker Compose are correctly installed and up to date.
This project is licensed under the MIT License. See the LICENSE file for details.
- Watchdog for filesystem monitoring.