Currently I try to use:
"wget --user=xxx --password=xxx -r ftp://www.domain.com/htdocs/"
But this saves output files to current directory in this fashion:
curdir/www.domain.com/htdocs/*
I need it to be:
curdir/*
Is there a way to do this, I only see a way to use output prefix, but i think this will just allow me to define directory outside current dir?
When downloading a file, Wget stores it in the current directory by default. You can change that by using the -P option to specify the name of the directory where you want to save the file.
The ' --no-parent ' option (short ' -np ') is useful in this case. Using it guarantees that you will never leave the existing hierarchy. Supposing you issue Wget with: wget -r --no-parent http://somehost/~luzer/my-archive/
Let's start with something simple. Copy the URL for a file you'd like to download in your browser. Now head back to the Terminal and type wget followed by the pasted URL. The file will download, and you'll see progress in realtime as it does.
-q --quiet Turn off Wget's output.
You can combine --no-directories
if you want all your files inside one directory or --no-host-directories
to have subdirectories but no subdirectories per host with your --directory-prefix
option.
2.6 Directory Options
‘-nd’ ‘--no-directories’ Do not create a hierarchy of directories when retrieving recursively. With this option turned on, all files will get saved to the current directory, without clobbering (if a name shows up more than once, the filenames will get extensions ‘.n’).
‘-nH’ ‘--no-host-directories’ Disable generation of host-prefixed directories. By default, invoking Wget with ‘-r http://fly.srk.fer.hr/’ will create a structure of directories beginning with fly.srk.fer.hr/. This option disables such behavior.
‘-P prefix’ ‘--directory-prefix=prefix’ Set directory prefix to prefix. The directory prefix is the directory where all other files and subdirectories will be saved to, i.e. the top of the retrieval tree. The default is ‘.’ (the current directory). (From the wget manual.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With