Remote renaming of a unix file via ftp

Hi all,

i'm just after some help regarding a batch script.

I'm wanting to create a windows batch script which will push a file from my pc to a unix (AIX) system via ftp. i have this part working fine but as the file i'm sending already exists i want the script to also take a sideways copy of the remote file and give it a .todaysdate extension, i can't seem to get this working..any ideas ?

Rename the file locally prior to sending.

As always: stay away from ftp, it is insecure, it is prone to network attacks and you have to provide clear-text passwords for it to work. In most data centers ftp is positively forbidden - even forbidden to be installed.

I hope this helps.

bakunin

I currently am renaming the file locally prior to running my script but i want to avoid doing this. Security is not an issue.

hmm, you want to replace a script on the ftp-clients side with one running (inside an ftp.session?) on the server side. This will probably gain you nothing in terms of complexity. Further, the options within ftp to manipulate files are quite limited, so you will have to resort to other means.

You could set up a cron-job which looks in a certain directory on the server side and if there is a file without extension then rename it to having an extension. Depending on how often you transfer files you can then transmit the files without extension, the cron job would dee them and rename them. This will not work if you have to transfer files more often than the cron job runs, so you will have to choose the interval matchingly.

I hope this helps.

bakunin

When mentioning Operating Systems, please mention the exact version.

If you have a version of Windows which includes the rsh command, that increases your options because you can instruct Windows Batch to execute a unix script (or command) on the remote machine. The method can also be made passwordless with a suitable .rhosts file.

Doesn't ftp have a move command which could do this?

In my version it's the rename ftp command. In basic MSDOS Batch it is really painful to retrieve a directory listing with ftp and then decide which files to rename. It's much easier to write a unix Shell script to do the job (and the file transfers as well). I'm assuming that the process is initiated from the Windows end because of some scheduling reason.