Folders, HTML Download Link, Save, Help.
#1
Lightbulb 
Hi! Yesterday i had this folder, with HTML files and i wanted each html file in a separate folder, with the same name as the file. So i searched around and i found this command on one of the topics:

FOR %i IN (.) DO (IF NOT EXIST "%~ni" MD "%~ni") & (MOVE "%i" "%~ni")

So the files were like this:

C:\files\lol4.html
C:\files\lol3.html
C:\files\lol5.html

and after the command they became like this:

C:\files\lol4\lol4.html
C:\files\lol3\lol3.html
C:\files\lol5\lol5.html

Perfect! that's what i wanted! Now in each of those HTML files have a download link to a rar file in it, I want to download them and save them in the same folder.

So if what i said above is possible, after the downloads the folders in C:\files will contain this:

C:\files\lol4\lol4.html C:\files\lol4\lol4.rar
C:\files\lol3\lol3.html C:\files\lol3\lol3.rar
C:\files\lol5\lol5.html C:\files\lol5\lol5.rar

The HTML files also contain a JPG link. I want it to be saved in the same folder, just as the rar files. There are more then 700 folders and html files, so if someone could kindly tell me how to do that it would be much appreciated. I also wish to know where can i learn such type of language?

Thanks in advance for the attention.
Reply
#2
wat
Reply
#3
That's just simple DOS/Windows Commands.

If you want to use that excellent script language Big Grin for this, you will need to look a liitle more of these commands:

FOR - to loop through the html files in combination with:
DIR - to dir files in alla subdirectories
TYPE - to type the html file in combination with:
| - (pipe) to pipe the output to:
FINDSTR - to find the links to rar and jpg files, supports (very) limited regular expressions
SET - If it's needed to replace/strip charactars in the links

You'll also need to read up on CALL, GOTO, ECHO and then I think you are good.

Then you need to download WGET to actually download the files.
Maybe you'll need some other 3rd party tools to solve issues depanding on how the html files look like.

Here you have some tips on what you can do: http://www.dostips.com/
For almost every command you can use /? to get some help and examples.
try FOR /?

Or you can do it in some better script language, on Windows PowerShell is the new script language, very powerful, I recommend you to learn this.
Or VBScript which also is built-in in Windows.

Or maybe install something like Python, Perl, PHP and so on.
Reply

Logout Mark Read Team Forum Stats Members Help
Folders, HTML Download Link, Save, Help.0