bug-wget
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SOLVED] RE: Wget with Download directory containing spaces


From: michel . kempeneers
Subject: [SOLVED] RE: Wget with Download directory containing spaces
Date: Tue, 17 Dec 2019 00:54:54 +0100 (CET)

Hi, 

I received several suggestions, but no real solution for the issue has 
surfaced. 
Apparently, the average Wget user is wise, and makes sure not the use directory 
names with spaces, so nobody really seems to know how to implement such names 
when needed. 

In DOS (Win7, x64) the following command 

wget -nv -a log.txt -P " .\Other Images\ " -i input.txt 

will fail due to the double quotes, which Wget doesn't like for this particular 
switch. (even though double quotes are the standard batch answer to paths 
containing spaces) 
If the quotes are left out, Wget will create a sub-directory "Other". 

So, I've also tried to escape the quotes, without knowing if that would do any 
good, as Wget still may not like the outcome. 
While doing so, I suddenly realized that the dot (= current directory, as 
opposed to ".." for parent directory in DOS) may actually be the true problem. 
Or to put that in other words: the issue is really about relative vs. absolute 
path . 
And indeed, if I replace the target for -P by 

" D:\some\more\subfolder \Other Images\" 

or even 

" \some\more\subfolders \Other Images" 

Wget will work as expected! 

This command can be generalized by using the following parameter extension: 

wget -nv -a log.txt -P " %~dp0 \Other Images " -i input.txt 

In which d=drive, and p=path of the batch file itself (which in my scenario is 
also the active directory). For some more feedback, see: 
[ 
https://stackoverflow.com/questions/1645843/resolve-absolute-path-from-relative-path-and-or-file-name
 | 
https://stackoverflow.com/questions/1645843/resolve-absolute-path-from-relative-path-and-or-file-name
 ] 

For completeness' sake, I'll add that according to the log file the above 
command resolves into sth. like 

-> "D:/some/more/subfolders / /My Files/L083192 (1).JPG" [1] 

Which troubles me both for the slashes (forward, as opposed to the backslashes 
in my original command), as well as the doubling of the slash in front of my 
actual download folder. 
The former may be a matter of notation, and may be linked to the genesis of the 
Wget tool. 
And though the double slash seems pretty bizarre, I assume it doesn't harm 
either, as the output is correct. Which is what matters. 

Thx for all the feedback, 

MK 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]