Link to home
Start Free TrialLog in
Avatar of vodyanoi
vodyanoi

asked on

Remove file extension after successful ftp transfer

requirement: To remove file extension from remote file after succesful automated ftp transfer.

The file is of the form WDC0001.tmp and needs to be changed to WDC0001 on completion of the file transfer.  This is a requierment of the client as they scan the destination folder and process files constantly.  For this reason they do not allow transfer of files without a temporary file extension.

The issue is the number 0001 is a random number and varies for every file that has to be transfered.

The process needs to be automated as the client requires delivery at around 2.30am every day.
We have no issue sending the file. It will be the only file in the source and destination folders. So we can use mput *.tmp to send the file

The difficulty we have is how to remove the file extension from the remote file once it has been delivered.

The machine we are using to send the files is running windows server 2008

So we have access to powershell if needed for scripting.  The server also has a copy of WSFTP_Pro 12 installed if that is of any use.

Does anyone have a suggestion as to how we can achieve this?
Avatar of Nrisimha
Nrisimha
Flag of Croatia image



Here is a the all procedure:

E:\TMP\FTP>ftp example.com
Connected to example.com
220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
220-You are user number 16 of 1000 allowed.
220-Local time is now 09:30. Server port: 21.
220-This is a private system - No anonymous login
220-IPv6 connections are also welcome on this server.
220 You will be disconnected after 15 minutes of inactivity.
User (example.com:(none)): billgates@example.com
331 User billgates@example.com OK. Password required
Password:
230-OK. Current restricted directory is /
230 1015327 Kbytes used (99%) - authorized: 1024000 Kb
ftp> cd wd
250 OK. Current directory is /wd
ftp> put WDC0001.tmp
200 PORT command successful
150 Connecting to port 1790
226-1015432 Kbytes used (99%) - authorized: 1024000 Kb
226-File successfully transferred
226 2.530 seconds (measured here), 41.60 Kbytes per second
ftp: 107945 bytes sent in 1,66Seconds 65,18Kbytes/sec.
ftp> rename WDC0001.tmp WDC0001
350 RNFR accepted - file exists, ready for destination
250 File successfully renamed or moved
ftp>


The file  WDC0001.tmp is on my comuter in folder E:\TMP\FTP.
Then I go to Start-Run and write a CMD and click OK.

Now, it is important to go to the E:\TMP\FTP and press dir *.tmp see your WDC0001.tmp dfile.

 User generated image
ASKER CERTIFIED SOLUTION
Avatar of AlexPace
AlexPace
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of vodyanoi
vodyanoi

ASKER

Persuaded the client to work this way.

Tested and it works like a dream.  They just had to get a copy of  Robo-ftp

Many thanks
whoops, that script has a bug ... that last line should say GOTO connect instead.