Page 1 of 1
request: Simple Batch Downloader and Renamer from List
Posted: 17 Mar 2014 15:22
by Andy Petrov
Hi dear members!
TC has a great feature -
Batch Downloader and Renamer from List. (txt file)
Algorithm (from txt file):
http://downloadsomething1.ext -> renamed1.ext
http://downloadsomething2.ext -> renamed2.ext
http://downloadsomething3.ext -> renamed3.ext
...etc. just like in Total Commander.
Please help in the implementation of this script!
TIA
Re: request: Simple Batch Downloader and Renamer from List
Posted: 17 Mar 2014 15:41
by Marco
Could you please explain with a few more words what you give in input and what you want as output of such script?
Re: request: Simple Batch Downloader and Renamer from List
Posted: 17 Mar 2014 15:49
by Andy Petrov
Input:
somethingdown.txt with the following contents
http://downloadsomething1.ext -> renamed1.ext
http://downloadsomething2.ext -> renamed2.ext
http://downloadsomething3.ext -> renamed3.ext
Output:
renamed1.ext
renamed2.ext
renamed3.ext
Re: request: Simple Batch Downloader and Renamer from List
Posted: 17 Mar 2014 16:02
by highend
Code: Select all
$file = readfile(inputfile(, , "Select the file which contents will be downloaded..."));
foreach($line, $file, "<crlf>") {
if ($line != "") { download gettoken($line, 1, " -> "), gettoken($line, 2, " -> "); }
}
This
could work... (but I didn't tested it yet)
Re: request: Simple Batch Downloader and Renamer from List
Posted: 17 Mar 2014 16:03
by Marco
Code: Select all
$inputfile = inputfile("%desktop%", "txt", "Select the file of the download list");
$input = readfile($inputfile);
foreach ($line, $input, <crlf>) {
$url = gettoken($line, 1, " -> ");
$name = gettoken($line, 2, " -> ");
download $url, $name;
};
Re: request: Simple Batch Downloader and Renamer from List
Posted: 17 Mar 2014 16:09
by SkyFrontier
...or this (a more general solution), which offers dialogs asking for
>links to download (auto-filled with clipboard content)
>search and replacement terms (as much as you need) - search|replacement*search2|replacement2, and so on; sometimes you just need the job done instead of creating a list with predefined search&Replacement, which can be freely done using this version.
and renames on collision.
Re: request: Simple Batch Downloader and Renamer from List
Posted: 17 Mar 2014 17:26
by Andy Petrov
highend, thank you, works fine!
Simple Batch Downloader and Renamer from List without prompt dialog, just select txt file and load script:
Code: Select all
$file = readfile(<curitem>);
foreach($line, $file, "<crlf>") {
if ($line != "") { download gettoken($line, 1, " -> "), gettoken($line, 2, " -> "); }
}
Re: request: Simple Batch Downloader and Renamer from List
Posted: 17 Mar 2014 17:39
by highend
I'd make a minor change:
Code: Select all
if ($line != "") { download trim(gettoken($line, 1, "->")), trim(gettoken($line, 2, "->")); }
It's a bit more failure proof regarding spaces.