Rename a file using command line in Core FTP Lite

Core FTP client questions and answers
Post Reply
rb
Posts: 5
Joined: Mon Mar 26, 2007 6:22 pm

Rename a file using command line in Core FTP Lite

Post by rb »

I need to sFTP a file with .tmp extension using command line and once the transfer is complete, rename the file to a different extension. Seems like -FN can't be used to rename an existing file. Is there any other way to rename a file?
rb
Posts: 5
Joined: Mon Mar 26, 2007 6:22 pm

Post by rb »

I wanted to avoid the GUI and put everything in a script file, so that setting up the app on other machines is as easy as just copying the script file. Does CoreFTP (LE or PRO) have a command line option to RENAME a file using sFTP?

I am looking for equivalent for FTP rename command:
rename FileName NewFileName

corecmd.exe -ssh -s -u "D:\sFTPTest\HMISP.D.FIL.CUC.B93Y.MAR2807.pgp" "sftp://userid:password@xxx.yyy.com/home/userid/to_xxx/" -FN "test.file.tmp" -log "D:\sFTPTest\log.txt" -output "D:\sFTPTest\output.txt"

Looks like FN only renames the file when you are uploading and you can't use it once the file has been uploaded.
ceva
Posts: 1
Joined: Tue Sep 11, 2007 3:49 pm

Post by ceva »

Following on from RB's request i am planning on using the scripting to perform a rename on the host files using RNFR and RNTO but want to include a extra file extension of '.lck' i.e

RNFR /from_client/%1
RNTO /from_client/%1 + ".LCK"

please can you help me with the correct syntax, how do i append an additonal string to the rename function?
evanyuan
Posts: 9
Joined: Tue Oct 17, 2006 3:00 pm

Post by evanyuan »

CP, I have the same requirement here. upload a file first, then rename the file.

We're using site to connect SSH FTP server in command model. Is there a way to achieve this renaming in command model?
evanyuan
Posts: 9
Joined: Tue Oct 17, 2006 3:00 pm

Post by evanyuan »

we want to upload file abc.inp, then rename to abc.txt

use post-transfer-command
RNFR /original_sourcepath/%1
RNTO /processed/%1.txt

the file name we get is abc.inp.txt, is there any means to meet our needs?


The reason for the rename is the SFTP server side has a monitor,which will grab any .txt file, if we upload a .txt file directly, the monitor could pick a unfinished file. so it's a must to upload .inp then rename to .txt.
Post Reply