request: Simple Batch Downloader and Renamer from List

Discuss and share scripts and script files...
Post Reply
Andy Petrov
Posts: 10
Joined: 17 Mar 2014 14:40

request: Simple Batch Downloader and Renamer from List

Post by Andy Petrov »

Hi dear members!
TC has a great feature - Batch Downloader and Renamer from List. (txt file)

Image

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
Last edited by Andy Petrov on 17 Mar 2014 16:02, edited 1 time in total.

Marco
Posts: 2354
Joined: 27 Jun 2011 15:20

Re: request: Simple Batch Downloader and Renamer from List

Post 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?
Tag Backup - SimpleUpdater - XYplorer Messenger - The Unofficial XYplorer Archive - Everything in XYplorer
Don sees all [cit. from viewtopic.php?p=124094#p124094]

Andy Petrov
Posts: 10
Joined: 17 Mar 2014 14:40

Re: request: Simple Batch Downloader and Renamer from List

Post 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

highend
Posts: 14942
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: request: Simple Batch Downloader and Renamer from List

Post 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)
One of my scripts helped you out? Please donate via Paypal

Marco
Posts: 2354
Joined: 27 Jun 2011 15:20

Re: request: Simple Batch Downloader and Renamer from List

Post 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;
 };
Tag Backup - SimpleUpdater - XYplorer Messenger - The Unofficial XYplorer Archive - Everything in XYplorer
Don sees all [cit. from viewtopic.php?p=124094#p124094]

SkyFrontier
Posts: 2341
Joined: 04 Jan 2010 14:27
Location: Pasárgada (eu vou!)

Re: request: Simple Batch Downloader and Renamer from List

Post 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.
To see the attached files, you need to log into the forum.
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...

Andy Petrov
Posts: 10
Joined: 17 Mar 2014 14:40

Re: request: Simple Batch Downloader and Renamer from List

Post 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, " -> "); }
    }

highend
Posts: 14942
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: request: Simple Batch Downloader and Renamer from List

Post 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.
One of my scripts helped you out? Please donate via Paypal

Post Reply