Page 1 of 1

About BK Puppy file downlaoder [SOLVED]

Posted: Fri 30 Nov 2012, 12:38
by Argolance
Hello,
Using the wget option [-O], it is possible to download a file to any chosen directory/filename. For example:

Code: Select all

# wget http://mysite/puppylinuxstuff/picture.png -O /root/my-documents/my-pictures/filename.png
The BK script 'download_file', (which seems to be a GUI for wget) automatically downloads files to /root. I would like to be able to choose, at least, the target directory. Is there a way to do it using a command line and without having to modify the original script?
For example, I tried this but :cry: :

Code: Select all

# download_file http://mysite/puppylinuxstuff/picture.png > /root/my-documents/my-pictures/filename.png
Thank you.
Cordialement.

Posted: Fri 30 Nov 2012, 15:10
by RSH
Hi.

i do use wget-option --directory-prefix=$LP2BDL wherein $LP2BDL is the LazY Puppy boot directory to download the LazY Puppy sfs files from the RunScripts directly to the boot directory.

After download you can rename the downloaded file using bash command mv if needed.

RSH

Posted: Fri 30 Nov 2012, 15:29
by sc0ttman
Save the following as 'download_progress':

the 1st option is the URL to download, the 2nd (optional) parameter is the output filename, or output dir (if it's a dir)

Code: Select all

#!/bin/bash
# original script by technosaurus
#18012012: fixed to work on akita: no busybox, wget -c, added some translations, error checking, etc
 
#usage, cli options
{ 
	[ "$1" = "" ] && echo "Usage: $(basename $0) URL [output file]" && exit 1
if [ "$2" != "" ];then # add output file or dir, if given
	[ -f "$2" ] && OUTPUTFILE="-O$2"
	[ -d "$2" ] && OUTPUTFILE="-P$2"
else 
	OUTPUTFILE=''
fi
export OUTPUTFILE
}
# i18n, translations
{
[ $myLANG ] || myLANG=${LANGUAGE%% *}
[ $myLANG ] || myLANG=${LANG%_*}
case $myLANG in
   de*)
		Loc_downloading_file="Download der Datei"
		Loc_download_progess="Download-Fortschritt"
		Loc_files_remaining="Dateien übrig"
		Loc_current_file_is="Aktuelle Datei ist"
      ;; 
  es*)
		Loc_downloading_file="Descargar el fichero"
		Loc_download_progess="El progreso de descarga"
		Loc_files_remaining="archivos restantes"
		Loc_current_file_is="Archivo actual es"
      ;; 
  fr*)
		Loc_downloading_file="Fichiers en cours de téléchargement"
		Loc_download_progess="Progression du téléchargement en cours"
		Loc_files_remaining="Fichier(s) restant(s)"
		Loc_current_file_is="Le fichier actuellement en téléchargement est"
      ;; 
  nl*)
		Loc_downloading_file="Downloaden bestand"
		Loc_download_progess="Download vooruitgang"
		Loc_files_remaining="bestanden over"
		Loc_current_file_is="De huidige bestand is"
      ;; 
  ru*)
		Loc_downloading_file="Загрузка файла"
		Loc_download_progess="Прогре

Posted: Fri 30 Nov 2012, 16:27
by Argolance
Hello,
Thank you for answering...
@RSH,
After download you can rename the downloaded file using bash command mv if needed.
I wanted to use the BK script, because it tests if file exists, has already been completely or just partially downloaded and so on, displays a progress bar instead of the classical wget urxvt window and is already 'gettexted'. I could indeed simply move/rename the downloaded /root/file but I am not sure the file is always downloaded at this place, depending (perhaps?) on the running Puppy mode (?).
Question: is the file always downloaded at this place?

@sc0ttman,
The script by technosaurus is quite interesting but doesn't make all what I am waiting for. If downloaded file already exists, windows appears quickly and closes immediately, and user don't know exactly what happens.
Else: Sorry, I could not define the output directory/filename. File is downloaded in the script directory :oops:
For example (usage: techscript.sh URL [output file]):

Code: Select all

# ./techscript.sh http://mysite/puppylinuxstuff/picture.png  /root/my-documents/my-pictures/filename.png
Did I miss something?

EDIT:
he 1st option is the URL to download, the 2nd option is the output filename, or output dir (if it's a dir)
Okay, okay:

Code: Select all

# ./techscript.sh http://mysite/puppylinuxstuff/picture.png  /root/my-documents/my-pictures/
Cordialement.

Posted: Fri 30 Nov 2012, 17:21
by Argolance
Hello,
I found 'a' solution:
Question: is the file always downloaded at this place?
I well noticed it was not always the same place, probably depending on the rox-filer active directory window (?)

Code: Select all

# cd /root/my-documents/my-pictures/
# download_file http://mysite/puppylinuxstuff/picture.png
... and I find my downloaded file in /root/my-documents/my-pictures/
8)

Thank you!
Cordialement.