Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Re: Problem overwriting files with mv commant

@tomer: Sorry, indeed, the change was rolled back in the end. You can vote for it to be implemented in the tracker.
Gashan

call mv -f * worked for me.

Thank you for the idea.
Guest

Try
call mv -f lcenewbkg-*.csv /home/samba/archive-bkgdata/

That will execute the remote command mv with -f switch to force an overwrite.
martin

Re: Move command for overwrite

Jayakanth wrote:

1. Is there a option to overwrite?

No. (2023: There is now, see below)

2. If 1 is not possible; is there a option to send an email (write some script within winscp) saying overwrite failed.

Please read documentation:
Emailing script results

Are there any future enhancements to the product with Move (mv) having the overwrite facility?

Sorry, we are not planning that.
Jayakanth

Move command for overwrite

Martin...
We keep getting plenty of files onto our remote server, so on a daily basis we run a batch file to copy and then move the files to the backup folder, however whenever there is an existing file, it fails and does not move..

  1. Is there a option to overwrite?
  2. If 1. is not possible; is there a option to send an email (write some script within WinSCP) saying overwrite failed.

by doing this we would at least know that there is something waiting to be moved.

Are there any future enhancements to the product with Move (mv) having the overwrite facility?

Thanks, Jay
martin

Re: Move with overwrite

Chris Guest wrote:

1. get (remote file to local directory)
2. delete (remote file in original directory)
3. put (local file on destination remote directory)

I would do:

  1. delete (remote file in destination directory)
  2. mv (move remote file from original to destination directory)

There's no cpcommand (edit 2021: there's cp command now).

Can you then confirm that option 3. will allow for an overwrite as I can't see it in the switches list for put?

Not needed IMHO, but the option is option confirm off
Chris Guest

Move with overwrite

Hi,

Can you confirm the only way to move a file from one remote folder to another then (on same server) with the ability to overwrite is to do the following:

  1. get (remote file to local directory)
  2. delete (remote file in original directory)
  3. put (local file on destination remote directory)

Can you then confirm that option 3 will allow for an overwrite as I can't see it in the switches list for put?

Could this be some future functionality (a mv with overwrite switch)?

Also what's the cp command that was mentioned? I can't find any references to it?

Cheers
Guest

Re: Problem overwriting files with mv commant

OK – sorry, it was the Copy option which gives the overwrite option. As I understanding it, the Copy function also does not give you the option of overwriting using a command script. If it did, I could also use the cp command followed by the delete command, both using the wildcards.
martin

Re: Problem overwriting files with mv commant

@rsmallwood: I do not think that "Move to" prompts for overwrite. Can you post a screenshot showing that?
rsmallwood

Re: Problem overwriting files with mv commant

I right-click the file and select 'Move to...'

Thanks
martin

Re: Problem overwriting files with mv commant

How do you move them in the GUI?
rsmallwood

Problem overwriting files with mv commant

Hi

When I have downloaded files from the remote server, I want to move them to an archive folder on the remote server. I use the mv command to do this as follows:
mv lcenewbkg-*.csv /home/samba/archive-bkgdata/

I have to use a wildcard as the filename is different each day.

The problem is, if one of the files covered by the wildcard already exists in the archive-bkgdata folder, the mv command does not move the files. If I use the GUI to move them manually, I am presented with a message to overwrite the file, but there doesn't seem to be any such option for scripting the mv command. Am I missing something?

I have batch on and confirm off, but I understand these are not relevant for the mv command.

So, how do I get the mv command to always overwrite the files in the remote folder? Or is there another way of doing it?

Thanks
Robin