-3

I want to copy and move (or paste) the file into folder like backup program. But I don't know what to do :( I tried shutil.copy2(filename, example) but I couldn't use it on another environment because I didn't know A.

import os 
import shutil 
from tkinter import *
from filedialog import *

def func_open() :
    global filename
    filename = askopenfilename(parent = window, filetypes = (("SMI", "*.smi"), ("All", "*")))
    A = os.path.basename(filename)

I used tkinter function. and func_open is works by pressing button.

J.kang
  • 11
  • 3
  • What have you tried or researched so far? – Klaus D. Jun 14 '18 at 09:24
  • 9
    Possible duplicate of [How to move a file in Python](https://stackoverflow.com/questions/8858008/how-to-move-a-file-in-python), and/or [How to copy a file in Python](https://stackoverflow.com/questions/123198/how-do-i-copy-a-file-in-python) – l'L'l Jun 14 '18 at 09:26

1 Answers1

1

copy:

from shutil import copy
copy(source,destination)

move:

from shutil import move
move(source,destination)
letmecheck
  • 1,183
  • 8
  • 17