[Solved] Is it possible to use PuTTY psftp.exe to move file from one directory to another?

Hello All,
I am running a script (power shell) from my desktop (Windows). The script needs to sftp a file(using PuTTY psftp.exe ) from my desktop to a server(UNIX server). Then, as a second step, the script needs to move (or copy and delete) this file from one directory on the server (UNIX server) to another directory on the same server (UNIX server).
I have no issues executing the first step. However, I cannot figure out how to execute the second step(move the file) using PuTTY psftp.exe .

Thanks in advanced,
AK,

You should be able to use the rename command.

$ sftp scott@dns1 << !
> put test1 /tmp
> rename /tmp/test1 /home/scott/testX1
> !
Connected to dns1.
sftp> put test1 /tmp
Uploading test1 to /tmp/test1
test1                                                         100%  117     0.1KB/s   00:00
sftp> rename /tmp/test1 /home/scott/testX1
$
$ ssh scott@dns1
$ pwd
/home/scott
$ ls -l testX1
-rwxr--r-- 1 scott dns1 117 2013-06-03 12:41 testX1

Is it worth asking why you just don't copy it to the target directory in the first place?

Thanks. this is what I was looking for !
BTW, to answer Scott's question, I can not copy the file directly because the process calls for authorization step where the file will be reviewed before being moved to its final destination.

Thanks,
AK,

Ah, OK. Just wondered :slight_smile: Thanks.