In case you missed the announcement: The Alteryx One Fall Release is here! Learn more about the new features and capabilities here
ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests Early 2026. Make sure to check your account preferences in my.alteryx.com to make sure you have filled out your security questions. Learn more here
Start Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Changing file extensions using a Python tool

knozawa
11 - Bolide

Hello,

 

I would like to change a file extension from .zip to .pptx using a python tool in Alteryx.

i.e. "MODIFIED.zip" to "MODIFIED.pptx".

image_3.png

 

Here is the script:

from ayx import Alteryx
import os
from pathlib import Path

directory = ('C:/Temp/PowerPoint test/DELETE_modified/DELETE_original/')

for f in Path(directory).rglob('.zip'):
    f.rename(directory + f.stem + '.pptx')

 

The script runs successfully, but zip file stays the same.

 

3 REPLIES 3
HomesickSurfer
12 - Quasar

Hi @knozawa 

 

I'm not overly familiar with Python.  Perhaps consider renaming the file extension with a batch script...

danilang
19 - Altair
19 - Altair

Hi @knozawa 

 

Consider using os.rename(src, dst) to change the name.

 

Dan

 

 

knozawa
11 - Bolide

Thank you @HomesickSurfer & @danilang !

 

I updated my script and it successfully updated the extension from .zip to .pptx.

from ayx import Alteryx
import os

directory = ('C:/Temp/PowerPoint test/DELETE_modified/DELETE_original/')

os.rename('MODIFIED.zip', 'MODIFIED.pptx')

 

Labels
Top Solution Authors