-1

I am currently trying to work on a program to automatically copy a PowerPoint into another file when ran however I cannot use shutil as it cannot handle pptx files any suggestions would be appreciated.

petezurich
  • 9,280
  • 9
  • 43
  • 57
J.Rimmer
  • 27
  • 6

1 Answers1

0

Just copying the file?

import os
os.popen('copy .\\file1.txt .\\test\\file1.txt')

If you're trying to move ALL .pptx files in a directory to a backup, something like this might work for a more, hassle-free method:

import os
from os import listdir
from os.path import isfile, join

path = "./"
included_extensions = ['pptx','PPTX']
allFiles = [f for f in listdir(path) if any(f.endswith(ext) for ext in included_extensions)]
length = len(allFiles)

for i in range(length):
    os.popen('copy .\\'+allFiles[i]+' .\\backup\\'+allFiles[i])
Mark Cook
  • 179
  • 1
  • 11