Help with Html Files inside of different folders
Moderator: DosItHelp
-
- Posts: 16
- Joined: 22 Aug 2012 18:30
Help with Html Files inside of different folders
Hi! A guy in another forum told me i could get help about this in here.
Ok so here we go. 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:[/b]
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.
Ok so here we go. 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:[/b]
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.
Last edited by camarguera on 23 Aug 2012 02:17, edited 1 time in total.
Re: Help with Html Files inside of diferent folders
You can download the files with WGET.EXE for Windows - which is a free download.
We cannot provide information on how to extract the URLS from the HTML files unless you show us what is inside the HTML files.
We cannot provide information on how to extract the URLS from the HTML files unless you show us what is inside the HTML files.
-
- Posts: 16
- Joined: 22 Aug 2012 18:30
Re: Help with Html Files inside of diferent folders
Oh! Yes! I'm sorry! Would it help if i paste it here?
Look, the <IMG SRC> link will be always a
cd-name-with-words-separated-by-a-hyphen300x300.jpg
and the files i need to download is the 20-%20MP3.zip">
Here it is:
Permanent Link to 12 Moons – Solid State">12 Moons – Solid State</a></h1>
<h3><span class="c"><a href="http://www.ektoplazm.com/section/free-music" title="View all posts in Free Music" rel="category tag">Free Music</a></span> <span class="dim">|</span> <span class="style"><strong><a href="/style/classic/">Classic</a></strong>, <strong><a href="/style/morning/">Morning</a></strong>, <strong><a href="/style/progressive/">Progressive</a></strong></span> <span class="dim">|</span> <span class="d">April 25, 2012</span> <span class="dim">|</span> Posted by <a href="http://www.ektoplazm.com/profiles/basilisk/" title="Visit Basilisk’s website" rel="author external">Basilisk</a></h3>
<div class="entry trackbg"><a href="http://www.ektoplazm.com/free-music/12-moons-solid-state" title="12 Moons – Solid State"><img src="http://www.ektoplazm.com/img/12-moons-solid-state1-300x300.jpg" class="cover" title="12 Moons – Solid State" alt="12 Moons – Solid State" /></a>
<div class="tl"><span class="n">01</span> - <span class="t">Analog Haste</span> <span class="d">(138 BPM)</span>
<br/><span class="n">02</span> - <span class="t">Ovation</span> <span class="d">(140 BPM)</span>
<br/><span class="n">03</span> - <span class="t">Pilot</span> <span class="d">(144 BPM)</span>
<br/><span class="n">04</span> - <span class="t">The Collective</span> <span class="d">(140 BPM)</span>
<br/><span class="n">05</span> - <span class="t">Without Within</span> <span class="d">(130 BPM)</span>
<br/><span class="n">06</span> - <span class="t">Ananokki</span> <span class="d">(133 BPM)</span>
<br/><span class="n">07</span> - <span class="t">Small Adventures</span> <span class="d">(142 BPM)</span>
<br/><span class="n">08</span> - <span class="t">Halo</span> <span class="d">(136 BPM)</span>
<br/><span class="n">09</span> - <span class="t">Interlude (Further...)</span> <span class="d">(140 BPM)</span>
<br/><span class="n">10</span> - <span class="t">Flair</span> <span class="d">(144 BPM)</span></div>
<p><strong>Solid State</strong> is the full-length debut of <a href="http://www.discogs.com/artist/12+Moons" target="_blank" class="lidiscogs">12 Moons</a> AKA <a href="http://www.michaelandresen.se" target="_blank" class="liexternal">Michael Andresen</a>, an artist who helped to define the “Scandosound”, a particularly artful and refined style of minimal and progressive psytrance that emerged around the turn of the millennium. Popularized by the legendary Spiral Trax imprint and acts like Human Blue, Vibrasphere, Atmos, S>Range, Noma, Ticon, and Son Kite, the Swedes redefined the parameters of the genre by stripping psychedelic trance down to the bare essentials. <a href="http://www.discogs.com/12-Moons-Solid-State/release/285141" target="_blank" class="lidiscogs">Originally released</a> on Candyflip Records in 2004, several years after the Scandosound first rose to prominence, Solid State represents the culmination of many years of artistic development for 12 Moons. Expect to hear emotionally charged trance music with brilliant arrangements of simple sounds, lush atmospheres, pulsating beats, and drifting melodies that seem to go on forever. The end effect, on each and every highly polished song, is a deep experience of an era that is now fading into history. This re-release features new artwork by <a href="http://www.michaelandresen.se" target="_blank" class="liexternal">Michael Andresen</a>. Mastered by Son Kite.</p>
<p><span class="dll"><a href="http://www.ektoplazm.com/files/12%20Moons%20-%20Solid%20State%20-%202004%20-%20MP3.zip">MP3 Download</a> <span class="dim">|</span> <a href="http://www.ektoplazm.com/files/12%20Moons%20-%20Solid%20State%20-%202004%20-%20FLAC.zip">FLAC Download</a> <span class="dim">|</span> <a href="http://www.ektoplazm.com/files/12%20Moons%20-%20Solid%20State%20-%202004%20-%20WAV.rar">WAV Download</a><span class="dc"><span class="dim"> · </span>
Look, the <IMG SRC> link will be always a
cd-name-with-words-separated-by-a-hyphen300x300.jpg
and the files i need to download is the 20-%20MP3.zip">
Here it is:
Permanent Link to 12 Moons – Solid State">12 Moons – Solid State</a></h1>
<h3><span class="c"><a href="http://www.ektoplazm.com/section/free-music" title="View all posts in Free Music" rel="category tag">Free Music</a></span> <span class="dim">|</span> <span class="style"><strong><a href="/style/classic/">Classic</a></strong>, <strong><a href="/style/morning/">Morning</a></strong>, <strong><a href="/style/progressive/">Progressive</a></strong></span> <span class="dim">|</span> <span class="d">April 25, 2012</span> <span class="dim">|</span> Posted by <a href="http://www.ektoplazm.com/profiles/basilisk/" title="Visit Basilisk’s website" rel="author external">Basilisk</a></h3>
<div class="entry trackbg"><a href="http://www.ektoplazm.com/free-music/12-moons-solid-state" title="12 Moons – Solid State"><img src="http://www.ektoplazm.com/img/12-moons-solid-state1-300x300.jpg" class="cover" title="12 Moons – Solid State" alt="12 Moons – Solid State" /></a>
<div class="tl"><span class="n">01</span> - <span class="t">Analog Haste</span> <span class="d">(138 BPM)</span>
<br/><span class="n">02</span> - <span class="t">Ovation</span> <span class="d">(140 BPM)</span>
<br/><span class="n">03</span> - <span class="t">Pilot</span> <span class="d">(144 BPM)</span>
<br/><span class="n">04</span> - <span class="t">The Collective</span> <span class="d">(140 BPM)</span>
<br/><span class="n">05</span> - <span class="t">Without Within</span> <span class="d">(130 BPM)</span>
<br/><span class="n">06</span> - <span class="t">Ananokki</span> <span class="d">(133 BPM)</span>
<br/><span class="n">07</span> - <span class="t">Small Adventures</span> <span class="d">(142 BPM)</span>
<br/><span class="n">08</span> - <span class="t">Halo</span> <span class="d">(136 BPM)</span>
<br/><span class="n">09</span> - <span class="t">Interlude (Further...)</span> <span class="d">(140 BPM)</span>
<br/><span class="n">10</span> - <span class="t">Flair</span> <span class="d">(144 BPM)</span></div>
<p><strong>Solid State</strong> is the full-length debut of <a href="http://www.discogs.com/artist/12+Moons" target="_blank" class="lidiscogs">12 Moons</a> AKA <a href="http://www.michaelandresen.se" target="_blank" class="liexternal">Michael Andresen</a>, an artist who helped to define the “Scandosound”, a particularly artful and refined style of minimal and progressive psytrance that emerged around the turn of the millennium. Popularized by the legendary Spiral Trax imprint and acts like Human Blue, Vibrasphere, Atmos, S>Range, Noma, Ticon, and Son Kite, the Swedes redefined the parameters of the genre by stripping psychedelic trance down to the bare essentials. <a href="http://www.discogs.com/12-Moons-Solid-State/release/285141" target="_blank" class="lidiscogs">Originally released</a> on Candyflip Records in 2004, several years after the Scandosound first rose to prominence, Solid State represents the culmination of many years of artistic development for 12 Moons. Expect to hear emotionally charged trance music with brilliant arrangements of simple sounds, lush atmospheres, pulsating beats, and drifting melodies that seem to go on forever. The end effect, on each and every highly polished song, is a deep experience of an era that is now fading into history. This re-release features new artwork by <a href="http://www.michaelandresen.se" target="_blank" class="liexternal">Michael Andresen</a>. Mastered by Son Kite.</p>
<p><span class="dll"><a href="http://www.ektoplazm.com/files/12%20Moons%20-%20Solid%20State%20-%202004%20-%20MP3.zip">MP3 Download</a> <span class="dim">|</span> <a href="http://www.ektoplazm.com/files/12%20Moons%20-%20Solid%20State%20-%202004%20-%20FLAC.zip">FLAC Download</a> <span class="dim">|</span> <a href="http://www.ektoplazm.com/files/12%20Moons%20-%20Solid%20State%20-%202004%20-%20WAV.rar">WAV Download</a><span class="dc"><span class="dim"> · </span>
Re: Help with Html Files inside of diferent folders
This works here.
It uses WGET for windows and
GetUrls.zip v1.0: Extracts URL's from an input stream.
Version 1.0, Copyright (C)2001 Frank P. Westlake
and expects them both to be on the path.
EDIT: Added two move commands to place the files in one folder. Change "c:\source" to where you want the files.
It uses WGET for windows and
GetUrls.zip v1.0: Extracts URL's from an input stream.
Version 1.0, Copyright (C)2001 Frank P. Westlake
and expects them both to be on the path.
Code: Select all
@echo off
pushd "c:\files"
for /f "delims=" %%a in ('dir *.html /b /s') do (
pushd "%%~dpa"
for /f "delims=" %%b in ('type "%%a" ^| geturls ^| findstr /i ".jpg mp3.zip"') do wget "%%b"
move *.jpg "c:\source"
move *.zip "c:\source"
popd
)
popd
pause
EDIT: Added two move commands to place the files in one folder. Change "c:\source" to where you want the files.
-
- Posts: 16
- Joined: 22 Aug 2012 18:30
Re: Help with Html Files inside of diferent folders
That looks like magic!
Okay, so i have to download that GetUrl.zip and the WGET for windows?
I read before about this wget, i alredy downloaded. It needs to be at the c:\windows right?
Would you please post a link for geturl.zip??? I've found different results and i don't know which is the right one...
I tried it without the geturls but didn't work, as expected:
'geturls' is not recognized as an internal or external command,
operable program or batch file.
I have a question, that will start downloading the mp3.zip automatically? It will save the .JPG in the same folder also?
Okay, so i have to download that GetUrl.zip and the WGET for windows?
I read before about this wget, i alredy downloaded. It needs to be at the c:\windows right?
Would you please post a link for geturl.zip??? I've found different results and i don't know which is the right one...
I tried it without the geturls but didn't work, as expected:
'geturls' is not recognized as an internal or external command,
operable program or batch file.
I have a question, that will start downloading the mp3.zip automatically? It will save the .JPG in the same folder also?
Last edited by camarguera on 23 Aug 2012 01:57, edited 1 time in total.
-
- Posts: 16
- Joined: 22 Aug 2012 18:30
Re: Help with Html Files inside of diferent folders
It worked!! it's downloading!! Sir you really got skills. While searching the geturls.zip i accidentaly found a post of you and it was written at 2005. You must really have alot of experience on that area!!!
Do you think it's possible for me to learn how to do those, in the future, without asking for help?? How do i learn to do it? How did you learn?
It's all on the site? What's the best way to start on it? I will read the entire dostips.com. Can i get all that by doing this? Maybe one day i can help people in foruns also! Thank you so much that's really awesome!
Do you think it's possible for me to learn how to do those, in the future, without asking for help?? How do i learn to do it? How did you learn?
It's all on the site? What's the best way to start on it? I will read the entire dostips.com. Can i get all that by doing this? Maybe one day i can help people in foruns also! Thank you so much that's really awesome!
Last edited by camarguera on 23 Aug 2012 03:14, edited 2 times in total.
Re: Help with Html Files inside of diferent folders
Cool! 
The .JPG and MP3.ZIP files should be saved in the individual folders.
Check it when it gets to the next lot and see if the top two folders have files, or zero byte files. The zero byte files can happen as it is downloading.

The .JPG and MP3.ZIP files should be saved in the individual folders.
Check it when it gets to the next lot and see if the top two folders have files, or zero byte files. The zero byte files can happen as it is downloading.
-
- Posts: 16
- Joined: 22 Aug 2012 18:30
Re: Help with Html Files inside of different folders
One thing i forgot: is it possible to change the save directory? Since they will download one by one i think it's better if they are all in a same folder.
Re: Help with Html Files inside of diferent folders
The way I learned is by getting a batch file that does something I need, and then modify it to add something. As you have success then your interest increases and - who knows where you will get to.
You might find Powershell or Windows Scripting Host better to tinker with as Powershell in particular is a modern implementation of scripting. I stick to batch files because I have experience with it, and it is easy to develop something that can solve a file system or a text manipulation problem. You can see that the task you wanted goes through so many folders and yet it's only a few lines of code.
To save them all in one folder - see the modification above. - the two move commands are all that is changed. Make sure that c:\source is a folder that exists
You might find Powershell or Windows Scripting Host better to tinker with as Powershell in particular is a modern implementation of scripting. I stick to batch files because I have experience with it, and it is easy to develop something that can solve a file system or a text manipulation problem. You can see that the task you wanted goes through so many folders and yet it's only a few lines of code.
To save them all in one folder - see the modification above. - the two move commands are all that is changed. Make sure that c:\source is a folder that exists
-
- Posts: 16
- Joined: 22 Aug 2012 18:30
Re: Help with Html Files inside of different folders
There is a little issue.
It is going in alphabetical order, that's okay, but then i realized it jumped some links, it said unknown host. I don't know. I think my internet was down or something. I had to restart, okay, but then it is downloading everything again. Saving as *1.zip file.
I don't need that it downloads again if the file alredy exists. Is there a way to set that?
Also is it possible to make it extract the .zip files?
It is going in alphabetical order, that's okay, but then i realized it jumped some links, it said unknown host. I don't know. I think my internet was down or something. I had to restart, okay, but then it is downloading everything again. Saving as *1.zip file.
I don't need that it downloads again if the file alredy exists. Is there a way to set that?
Also is it possible to make it extract the .zip files?
Re: Help with Html Files inside of different folders
This uses the same technique but run it from the folder that holds the files.
Regarding unzipping, that can be done but you will probably want the unzipped files to be in separate folders, right?
Code: Select all
@echo off
for /f "delims=" %%a in ('dir "c:\files\*.html" /b /s') do (
for /f "delims=" %%b in ('type "%%a" ^| geturls ^| findstr /i ".jpg mp3.zip"') do if not exist "%%~nxb" wget "%%b"
)
pause
Regarding unzipping, that can be done but you will probably want the unzipped files to be in separate folders, right?
-
- Posts: 16
- Joined: 22 Aug 2012 18:30
Re: Help with Html Files inside of different folders
Cool!
It still downloading the file, but now with the same name, instead of *1.zip. I think it will overwrite.
Saving to: `12 Moons - Solid State - 2004 - MP3.zip'<-this one already exists
I'm still testing, so, i still don't really know which would be better. In the same folder or different folder. Can i get both methods?
It still downloading the file, but now with the same name, instead of *1.zip. I think it will overwrite.
Saving to: `12 Moons - Solid State - 2004 - MP3.zip'<-this one already exists
I'm still testing, so, i still don't really know which would be better. In the same folder or different folder. Can i get both methods?
Last edited by camarguera on 24 Aug 2012 01:51, edited 2 times in total.
Re: Help with Html Files inside of different folders
How about you decide where you want the files?
All in one folder? With the JPG files and ZIP files?
This assumes that the ZIP files do not have embedded folders and also extra files.
You know that matching up the JPG files with the MP3 files could be difficult, unless they have similar file names.
Give it some thought, and pick an archiver. 7zip is probably a good choice.
All in one folder? With the JPG files and ZIP files?
This assumes that the ZIP files do not have embedded folders and also extra files.
You know that matching up the JPG files with the MP3 files could be difficult, unless they have similar file names.
Give it some thought, and pick an archiver. 7zip is probably a good choice.
Re: Help with Html Files inside of different folders
camarguera wrote:Cool!
It still downloading the file, but now with the same name, instead of *1.zip. I think it will overwrite.
Saving to: `12 Moons - Solid State - 2004 - MP3.zip'
Use this version and tell me what it prints to the console.
Code: Select all
@echo off
for /f "delims=" %%a in ('dir "c:\files\*.html" /b /s') do (
for /f "delims=" %%b in ('type "%%a" ^| geturls ^| findstr /i ".jpg mp3.zip"') do dir /b "%%~nxb" & echo if not exist "%%~nxb" wget "%%b"
pause
)
pause