Reputation: 2349
I am trying to download all of the files in a directory using:
wget -r -N --no-parent -nH -P /media/karunakar --ftp-user=jsjd --ftp-password='hdshd' ftp://ftp.xyz.com/Suppliers/my/ORD20130908
but wget
is fetching files from the parent directory, even though I specified --no-parent
. I only want the files in ORD20130908
.
Upvotes: 21
Views: 37570
Reputation: 9925
You need to add a trailing slash to indicate the last item in the URL is a directory and not a file:
wget -r -N --no-parent -nH -P /media/karunakar --ftp-user=jsjd --ftp-password='hdshd' ftp://ftp.xyz.com/Suppliers/my/ORD20130908
↓
wget -r -N --no-parent -nH -P /media/karunakar --ftp-user=jsjd --ftp-password='hdshd' ftp://ftp.xyz.com/Suppliers/my/ORD20130908/
From the documentation:
Note that, for HTTP (and HTTPS), the trailing slash is very important to ‘--no-parent’. HTTP has no concept of a “directory”—Wget relies on you to indicate what’s a directory and what isn’t. In ‘http://foo/bar/’, Wget will consider ‘bar’ to be a directory, while in ‘http://foo/bar’ (no trailing slash), ‘bar’ will be considered a filename (so ‘--no-parent’ would be meaningless, as its parent is ‘/’).
Upvotes: 33
Reputation: 81
wget -r -N --no-parent -nH -P /media/karunakar --ftp-user=jsjd --ftp-password='hdshd' -I/ORD20130908 ftp://ftp.xyz.com/Suppliers/my
See wget document for the use of -I
flag
Upvotes: 4