To the Top
File:  root - text - computing - mvjpg.bat.txt
Tags: 程序, Programming, | English | Home Page | Category: Computing | 3638 Views, 37862 Search Bots | 280 Words

Subscribe to Feed Burner | Browse | Archive
I have come to a problem... i have a pictures folder which has lots of subdirs and
lots of irregular filenames such as "kdjfksjdf.jpg", "kdjflkajsdfasd.jpg"
usually i renamed them randomly to avoid the same filenames when i grabbed it from internet...
So i want to upload them to the website and i want them arranged in good order....

Each folder should be ordered by numbers 1, 2, 3.....
Each folder has at most 39 files, 1.jpg, 2.jpg, .... 39.jpg
How can I do this?

So .... Super XP has provided batch file....

I 've done a little programming, it is fun!

******* save the following as .BAT file and modify vars as needed **********

@echo off

set cc=0
set dd=1
set od=D:\1
set td=D:\2
set nn=39
set ex=jpg

cls
echo.
echo Windows XP Batch file
echo Created by Zhihua Lai, 2007-Aug-30
echo The program can move all the %ex% files in %od% folder into
echo %td% folder and rename it by number
echo each folder (also labeled as number %dd% var) contains at most
echo %nn% pictures....
echo.

echo Press any key to continue, press Ctrl-C to exit....
pause >nul

rem cls

if not exist %td% mkdir %td% && echo %td% created...

for /f "usebackq delims==" %%i in (`dir /s /b %od%\*.%ex%`) do (
call :dothing "%%i"
)

goto :clear

:dothing
if exist "%1\nul" goto :end
if not exist "%td%\%dd%" mkdir "%td%\%dd%" && echo "%td%\%dd%" created...
set /a cc=cc+1 >nul
move %1 "%td%\%dd%\%cc%.jpg"
echo %1 has been moved to "%td%\%dd%\%cc%.jpg"!!!!
if /i "%cc%" EQU "%nn%" set /a cc=0 && set /a dd=dd+1
goto :end

:clear
set cc=
set dd=
set od=
set td=
set nn=
set ex=

:end
Tags: 程序, Programming, | English | Home Page | Cateogry: Computing | 3638 Views, 37862 Search Bots | 280 Words Subscribe to Feed Burner

Related Articles

  1. Skip the readings, focus on problems. And use all the hints!
  2. How to Play WAV music under DOS?
  3. Floor and Ceiling of a Binary Search Tree
  4. [Daily Problem] Witness of The Tall People
  5. Daily Interview Problem: Largest BST in a Binary Tree
  6. Daily Interview Question: Edit Distance
  7. Daily Interview Problem: Largest Product of 3 Elements I
  8. [Daily Problem] Remove k-th Last Element From Linked List
  9. Algorithm Interview: Level Order Traversal of Binary Tree
  10. ImageMagick Vulnerabilities -  CVE-2016–3714

Comments (0)

    Be the first one to comment this page !


Page Edited: May 11 2024 14:36:49 | RSS Subscription
How to Cook a Perfect Steak? | <meta name="robots" content="index, follow">