Toad World® Forums

copy file activity TDP 3.8 automation

Hi,

Not came here for a long time ! but I’ve tried this week this new release.

I had some problems to upgrade some scripts but it’s not the reason of this post.

I’m trying to copy a text file from a lan folder to a local folder using variables and wildcards in “copy file” activity.

It’s impossible to use a destination file name !!!

Waiting and downgrading to 3.7 !!

If you use Toad’s Run Program step you can build your own copy command any way you want. Better you can call a batch file with the Run Program do all kinds of complicated stuff set up in the batch (.bat) file, passing the parameters in on the Toad argument line. I have always preferred this method to the Toad Copy because of the flexibility it gives me from Toad versions going way way back. But then I go way way back to the old DOS days so batch files are 2nd nature to me.

thanks for this workaround.

i thought about it, i just wanted to choose the simpliest way.

The problem seems to be me ! When using wildcards in source file, several files should match, probably the reason why TDP blanks input destination file field.

My conclusion : copy file activity, only one…

I will try this new “run activity”, with return code management.

Sorry for this poor language, i’m french, nobody’s perfect.

Regards.

Franck

Franck,

Your English is great. If you use a batch file be careful if your variable name has a space in it. When variables are passed to a batch file it separates the variable by the space character. So if you know there will always be a space in the name (i.e. Input File.xls) then you would have pathVariable FileNameVariable on the argument line of the run activity and then in the .bat file you would have copy “%1%2 %3.xls” “destinationPath”. The PathVariable will go into %1 and FileNameVariable will go into %2 and %3 without the space in the name. You just have to put the space back in.

I would like to fix any issues you have. I performed the copy below and it works fine. You do have to put the . card in the Activity instead of the folder dialog. But other than that it works fine.

You can rename 1 file while copying or copy several files without renaming. Even the batch file would have difficulty with that one. You can do limited multi file renaming (like changing the file extension while copying with a batch file).

hi,

thanks for your replies.

I saw that copy of several files works without renaming.

The challenge is :

Find the most recent log file in a specific folder over 109 servers.

Rename and Copy these files on a specific server ((without timestamp, files have the same name).

loop over these files to extract data.

The problem is to find the right file !

Are you trying to find 1 file (most recent of all servers) or 1 file (most recent) for each server? Also, are the 109 servers static (can you set up a loop to go through each server 1 at a time)? If you are not dealing with a constant set of servers, consider maintaining a table of server names and file paths and use that table to create the loop.

One file for each server ! Loop over servers works fine.

I really feel at ease with variables and loops over servers with TDP.

For example, this path (with variable)

“\san#ROD_serv_GED#.tw.fxxxxa.net\G_frc_#ROD_serv_GED#\check_TW\test*.log”

in source file works for several files.

The wildcard in source name force blanking of copy name field.

After “negociating” with developer who generate this log,

a solution was found by normalizing filename,

Now,

source file :

\san#ROD_serv_GED#.tw.fxxxx.net\G_frc_#ROD_serv_GED#\check_TW\ctrl_cmpt_#ROD_serv_GED#_last.log

copy file :

#ROD_serv_GED#.log

Works perfectly !!

Thanks for your time…

regards.

Franck