Topic "mv command to replace files"

Author Message
move

Guest


I am giving 'mv' command to transfer files. But if file already exists, it gives error. I want to overwrite file, if already exists. How to do this with 'mv' command?
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24555
Location: Prague, Czechia
You cannot rename file to name of an existing file.
_________________
Martin Prikryl
ryc

Guest


prikryl wrote:
You cannot rename file to name of an existing file.


So, is there a way that I delete previuos file if exists, and mv the file. I have to move the file via script else it stays there in original directory.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24555
Location: Prague, Czechia
The easies way is to use WinSCP .NET assembly:
http://winscp.net/eng/docs/library

Or take a look at this example:
http://winscp.net/eng/docs/script_checking_file_existence
_________________
Martin Prikryl
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License