#!/usr/bin/env python
import sys
from res.fm.shell import copy_file

if __name__ == "__main__":
    src = sys.argv[1]
    try:
        if len(sys.argv) > 2:
            target = sys.argv[2]
            copy_file(src, target)
        else:
            copy_file(src)
    except IOError as e:
        sys.exit(f"COPY_FILE failed with the following error: {e}")
