Update main.py

Implemented check of free space before duplication.