I am using the Run Command tool to copy and rename files.
I want the command
copy C:\\StartFolder\Input.txt C:\\FinalFolder\Output.txt
to copy the contents of the first file into the new file and location.
but instead, it keeps the same file name and treats the file is another directory to create:
C:\\FinalFolder\Output.txt\Input.txt
Any work around or fix to my syntax?
Hi @pcatterson ,
you could try
copy C:\StartFolder\Input.txt C:\FinalFolder
I think, if the filename is not changed, you only need the destination folder.
Best,
Roland
Yes, leaving the name unchanged works
But I need to rename the file. Can I do this in one step or should I do it multiple steps?
I use this python code to copy/rename files from Alteryx. Just pass original file address in 'FileName' field and new file address in 'NewFileName' field.
from ayx import Alteryx
import shutil, os
df = Alteryx.read("#1")
sfile = df.at[0,"FileName"]
nFile= df.at[0,"NewFileName"]
nFile = folder + nFile
shutil.copy(sfile, nFile)
Alteryx.write(df,1)
Regards,
Vijay