문제

/tmp/cron_test/에 파일을 다운로드해야합니다. 내 wget 코드입니다

wget --random-wait -r -p -nd -e robots=off -A".pdf" -U mozilla http://math.stanford.edu/undergrad/

그렇다면 디렉토리를 지정할 매개 변수가 있습니까?

도움이 되었습니까?

해결책

매뉴얼 페이지에서 :

-P prefix
--directory-prefix=prefix
           Set directory prefix to prefix.  The directory prefix is the
           directory where all other files and sub-directories will be
           saved to, i.e. the top of the retrieval tree.  The default
           is . (the current directory).

따라서 추가해야합니다 -P /tmp/cron_test/ (짧은 형태) 또는 --directory-prefix=/tmp/cron_test/ (긴 형태) 명령에. 또한 디렉토리가 존재하지 않으면 생성됩니다.

다른 팁

-o는 다운로드하려는 파일의 경로를 지정하는 옵션입니다.

wget <file.ext> -O /path/to/folder/file.ext

-P는 디렉토리에서 파일을 다운로드 할 접두사입니다.

wget <file.ext> -P /path/to/folder

다운로드하는 내용에 대해 URL이 올바른지 확인하십시오. 우선, 문자와 같은 URL이 있습니다 ? 그러한 것은 구문 분석하고 해결할 수 없습니다. 이것은 CMD 줄을 혼동하고 다운로드하는 파일 이름으로 소스 URL 이름으로 해결되지 않은 문자를 수락합니다.

예를 들어:

wget "sourceforge.net/projects/ebosse/files/latest/download?source=typ_redirect"

이름이 지정된 파일로 다운로드됩니다. ?source=typ_redirect.

보시다시피 URL에 대해 한두 가지를 아는 것은 이해하는 데 도움이됩니다. wget.

Hirens 디스크에서 부팅 중이며 리소스로서 Linux 2.6.1 만 가지고있었습니다 (가져 오기 OS를 사용할 수 없음). 물리적 하드 드라이브에 ISO를 다운로드하는 문제를 해결 한 올바른 구문은 다음과 같습니다.

wget "(source url)" -O (directory where HD was mounted)/isofile.iso" 

어떤 시점에서 찾아서 올바른 URL을 알아낼 수 있습니다. wget 이름이 지정된 파일로 다운로드합니다 index.html (기본 파일), 다음 명령으로 표시된 파일의 올바른 크기/기타 속성이 있습니다.

wget "(source url)"

해당 URL과 소스 파일이 정확하고 다운로드 중입니다. index.html, 다운로드를 중지 할 수 있습니다 (Ctrl 키 + ) 및 사용하여 출력 파일을 변경하십시오.

-O "<specified download directory>/filename.extension"

소스 URL 후.

제 경우에는 ISO를 다운로드하여 아래의 이진 파일로 저장합니다. isofile.iso, 희망적으로 마운트.

man wget : -o 파일 -output -document = file

wget "url" -O /tmp/cron_test/<file>

이 방법을 시도하십시오 -

import os
path = raw_input("enter the url:")
fold = raw_input("enter the folder:")
os.system('wget -r -nd -l1 -P %s --no-parent -A mp3 %s'%(fold, path))
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top