Computing.Net > Forums > Programming > Need to increment filename to DL lot of files

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Need to increment filename to DL lot of files

Reply to Message Icon

Name: dorlow
Date: May 15, 2009 at 22:24:26 Pacific
OS: Windows Vista
Subcategory: General
Comment:

Hi, I lost a ton of pictures. I just remembered I had all of them backed up on my myphotoalbum site... I need to download them all again. I've figured out how to do it manually.

Here is the URL of one of the pictures...

http://bobjoe.myphotoalbum.com/view_photo.php?set_albumName=album63&id=DSC02890&full=true" target="_blank

The filename is the DSC02890 part. If I change it to DSC20891, 892, 893, etc, it will keep on changing the picture, I then right click on the picture and save it.

I accidently lost a ton of pictures a few years back and I had to get them back. I can't remember how I did it, but I wrote a script that kept on incrementing it. It would just keep on incrementing until there were no pictures, then I'd see that the screen would start flashing file not found or something similar and I'd have to break out of the command. But, still beats going to each one individually, right click on the picture and click save.

Does anyone have any clue on how to write the script to download all the files by just writing some while statement or for statement or whatever to keep on incrementing that number forever and then download each picture?



Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: May 16, 2009 at 02:56:11 Pacific
Reply:

That link didn't do anything for me. But as to incrementing numbers, try this:

===========================

<B>:: increment pic num
:: picno Sat 16-05-2009 15:50:31.98

@echo off & setLocal EnableDelayedExpansion

if not %2'==' (
  set start=%1
  set end=%2
  ) else (
    set /p start=low number ?
    set /p end=last number ?
  )
)

for /L %%a in (!start! 1 !end!) do (
  set NUM=%%a
  call :padder
  echo !NUM!
)

goto :eof

:padder
  :loop
    if !NUM:~0^,1! equ 0 (
    set NUM=!NUM:~1^,11!
    goto :loop
    )

  :loop2
    if !NUM:~4^,1!'==' (
    set NUM=0!NUM!
    goto :loop2
    )

goto :eof


=====================================
If at first you don't succeed, you're about average.

M2


0

Response Number 2
Name: dorlow
Date: May 16, 2009 at 06:12:41 Pacific
Reply:

(I made a bogus link above for the first part of the URL to keep our family pics private.)


0

Response Number 3
Name: dorlow
Date: May 16, 2009 at 06:28:27 Pacific
Reply:

Here's how I used what you did and it isn't working yet.

===========================

:: increment pic num
:: picno Sat 16-05-2009 15:50:31.98

@echo off & setLocal EnableDelayedExpansion

if not %2'==' (
set start=%1
set end=%2
) else (
set /p start=low number ?
set /p end=last number ?
)
)

for /L %%a in (!start! 1 !end!) do (
set NUM=%%a
call :padder
echo !NUM!
"http://bobjoe.myphotoalbum.com/view_photo.php?set_albumName=album63&id=DSC!NUM!&full=true"
echo "http://bobjoe.myphotoalbum.com/view_photo.php?set_albumName=album63&id=DSC!NUM!&full=true"
)

goto :eof

:padder
:loop
if !NUM:~0^,1! equ 0 (
set NUM=!NUM:~1^,11!
goto :loop
)

:loop2
if !NUM:~4^,1!'==' (
set NUM=0!NUM!
goto :loop2
)

goto :eof

The output I get when running it is...

C:\Users\Bob Joe\Desktop>batch.bat

C:\Users\Bob Joe\Desktop>increment pic num 0<B 1>::
The system cannot find the file specified.
low number ?02890
last number ?02890
00002
The system cannot find the path specified.
"http://bobjoe.myphotoalbum.com/view_photo.php?set_albumName=album63&id=DSC0000
2&full=true"

C:\Users\bob joe\Desktop>

It didn't even put in my numbers I entered. It put in 00002.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Need to increment filename to DL lot of files

Program to rename tons of files? www.computing.net/answers/programming/program-to-rename-tons-of-files/11667.html

Batch to scan for new files www.computing.net/answers/programming/batch-to-scan-for-new-files/14489.html

Need to get filename & size www.computing.net/answers/programming/need-to-get-filename-amp-size/15848.html