Windows FTP - skip file if it already exists
Solution 1
Kindly refer http://docs.attachmate.com/reflection/ftp/15.6/guide/en/index.htm?toc.htm?7482.htm once. skip option is available in mget.
e.g. you can use the following line
MGET *.* "C:\My documents*.*" skip
Solution 2
The built-in Windows ftp.exe
client does not allow you to skip existing files.
You have to use a different FTP client.
For example with WinSCP, you can use following batch file (.bat
):
winscp.com /log=ftp.log /command ^
"open ftp://username:[email protected]/" ^
"get -neweronly /path/* c:\path\" ^
"exit"
Note the -neweronly
switch. It makes WinSCP download only non-existing file or file that were updated since the last download.
For details see:
- Guide to scripting with WinSCP;
-
WinSCP
get
command; - Guide to converting Windows FTP script to WinSCP
(I'm the author of WinSCP)
Related videos on Youtube
jholmie2
Updated on September 18, 2022Comments
-
jholmie2 over 1 year
I have a little script in Windows that opens up a connection to a web server and downloads all the files using
mget
.However, the
mget
constantly downloads the files even if they already exist.Is there an FTP command that can skip already existing files?
-
Hastur over 9 yearsWelcome on superuser. With time links can become obsolete or not working and the related answer will result useless. In order to avoid it try to write the main idea of the link you post.
-
jholmie2 over 9 yearsThank you so much , I searched for available commands for mget , but couldn't find the skip option!
-
jholmie2 over 9 yearsIm confused , how to add the skip option? Say I use mget * to fetch all files , mget * skip don't work , or is my syntax wrong?
-
jholmie2 over 9 yearsI used like this > MGET *.* "C:\My documents*.*" skip and that results with Cannot find list of remote files.
-
jholmie2 over 9 yearsftp> MGET . "" skip (idk why I can't put * before . and after here) works but it does not skip files , is the syntax wrong?
-
Martin Prikryl almost 9 yearsThe answer uses a completely different
ftp
client than the OP, without bothering to mention it.