Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

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: Check if remote file exists

You can set "option batch continue" before the "rm" command to avoid the script be interrupted on error.
Ron2

Check if remote file exists

Hi,

perhaps somebody can help me with my problem. The main problem is that i want to move some remote files from one directory to another. If the files are already in the target directory i want to overwrite them. This task is part of a script and the number of the files to move can be different.

It is possible that some files in the target directory should stay there and other files should be replaced. For example i want to move/replace the files 'file1.txt' and 'file2.txt' and the existing file 'file3.txt' should be unchanged. With the mv-command i get an error because the files are already there.

Then i added a delete-step before i moved the files, but then i got an error, if the file, which i want to delete, does not exist.

Now i think the only way is to check for each moving-file, if the file exists in the target directory. If it exists i have to delete it and after this i can move the source file. But to check, if the file exists seems to be a new problem.

This normally simple task seems to be a problem for me. Perhaps can't see the simple solution and somebody can give me a hint.

Thanks for help
Ron