Toad World® Forums

Copy activity not renaming the file

Toad Data Point version: 4.3.0.718 (32 bit)

Im trying to copy an excel file to another location. The original file name has a date suffix that will change each month so I need to be able to look for a wildcard file name and then copy it. I also want to change the name of the file once it has been copied to the new location.

I have been following the instructions found here:
http://dev.toadfordataanalyst.com/webhelp/Content/Automation/Use_File_Automation_Activities.htm

I am using an asterisk to wildcard the file name in the Source File field and have given it a new name to assign to the file in the "Copy name" section.

The copy activity works fine, however the problem Im having is that it retains the original file name....it wont rename it to the new name.

There is no other file in the source folder.

Let me have QA test this and see what they find.

Unfortunately you cannot rename files when using wildcard in Copy File activity.
I would suggest to create batch file and execute it using Run Program activity.

Batch file example if you want static filename:
for %%I in (*.xlsx) do copy %%I c:\copy\newfile.xlsx

Or combination of text and original filename:
for %%I in (*.xlsx) do copy %%I "c:\copy\copy of %%I"

okay thanks. Please let me know what they find out.

Hi Debbie,

wondering if QA has gotten back with you on this?

Stanislov is my developer and he answered above. We do not support renaming files when using a wildcard. Instead says this can be done by using the Run Activity. Here you can use a copy cmd. He provides an example above.

Thanks for your response. Though that does work, the problem with using a batch file I'm finding is that it always emails me the following error:

Run_1 Error Message: UNC paths are not supported. Defaulting to Windows directory.

I know I could turn off error messages in the settings but I dont want to do that so that Im notified if a real error occurs.

Are you using a substitues drive? D:.... if you so, use the fully qualified path instead. \servername\dir\subdir and this should clear up that error.

Yep, using a fully qualified path but still throwing same error. It would be a really nice addition if you could add an activity to simply change a file name. The import activity requires a static file name to look for when importing a file, does not look it can look for a wild carded file name.