From the computer of: seamonkey420
(130 recipes)
Created: Dec 25, 2006 Updated: Dec 27, 2006
ALSO TEST PRIOR TO USING ON LIVE FILES!
Well, i like to organize my thousands of digital folders in a date type of hierarchy. i use a year > specific date format. so my "My Pictures" folder looks like this;
-[2003]
-[2004]
-[2005]
-[2006]
then in each year's folder, i have them named in a MM-DD-YYYY format, ie:
-[01-22-2006]
-[02-14-2006]
-[03-22-2006]
-[04-20-2006]
-[05-12-2006]
i decided that today i was sick of going in and doing all of my folder creating manually, so i wrote a batch file to do this.
here's the code (copy and paste into notepad. then save file as a text file. then rename to a .bat extension to make a batch file; ie named test.txt, rename to test.bat):
| Quote: |
|
@ECHO OFF @REM Author: seamonkey420 Date: 12/25/06 @REM This is my custom copy batch file for pictures. @REM It will create a new folder w/todays date in the My Pictures folder. @REM NOTE! always do a trial run first! you can run the batch file from any folder or path @REM No errorchecking is in place, be sure to type in the paths as D: or J: if the camera @REM drive is the D or J. case sensitive too. you can add these yourself if you'd like @REM Setting the global varibles @REM userfolder is basically which drive your my documents folder is located in @REM ---default should be fine for most people w/normal xp installs @REM cameraDrive is the drive for your camera @REM type is the type of files your camera saves your images as, most are jpg @REM (used to find folder of vids on camera) ECHO seamonkeys camera to pc copy script ECHO ________________ SET userfolder=C: SET type=jpg SET /P cameradrive=Enter Camera Drive Letter (ie D:) and hit Enter: @REM Finds what your userid is for user running script and then sets it as a user variable for /f "tokens=3 delims=\" %%i in ("%USERPROFILE%") DO (set user=%%i) @REM parses month, day, and year into mm , dd, yyyy formats to create folders off of! FOR /F "TOKENS=1* DELIMS= " %%A IN ('DATE/T') DO SET CDATE=%%B FOR /F "TOKENS=1,2 eol=/ DELIMS=/ " %%A IN ('DATE/T') DO SET mm=%%B FOR /F "TOKENS=1,2 DELIMS=/ eol=/" %%A IN ('echo %CDATE%') DO SET dd=%%B FOR /F "TOKENS=2,3 DELIMS=/ " %%A IN ('echo %CDATE%') DO SET yyyy=%%B SET date=%mm%%dd%%yyyy% @REM Creating a folder in the 'my pictures' folder w/the [MM-DD-YYYY] format @REM Also changes directory to the new folder @REM --I use a year\date hierarchy to sort photos, so for example: @REM -- [2006]\[12-25-2006]\dsc004.jpg, etc; keeps it easy to find via date %userfolder% cd\ cd "Documents and Settings\%user%\My Documents\My Pictures" mkdir "[%yyyy%]" cd "[%yyyy%] mkdir "[%mm%-%dd%-%yyyy%]" cd "[%mm%-%dd%-%yyyy%]" @REM Finds full path of where photos are on the camera @REM and also copies them to the new folder (limited to 2 subfolders, @REM you'll need to add a third for statement if your images are nested deeper and change token to 4) %cameraDrive% FOR /F "TOKENS=2 DELIMS=\" %%A IN ('dir /b /s *.%type%') DO SET p1=%%A FOR /F "TOKENS=3 DELIMS=\" %%A IN ('dir /b /s *.%type%') DO SET p2=%%A CD "%p1%\%p2%" COPY *.* %userfolder% @REM Delete the originals prompt and then actions SET /P delete=Delete Original Photos from Camera (y/n)? IF /I "%delete%"=="y" GOTO delY IF /I "%delete%"=="n" GOTO delN :delY %cameraDrive% del /q *.* explorer.exe "%userfolder%\Documents and Settings\%user%\My Documents\My Pictures\[%yyyy%]\[%mm%-%dd%-%yyyy%]" :delN explorer.exe "%userfolder%\Documents and Settings\%user%\My Documents\My Pictures\[%yyyy%]\[%mm%-%dd%-%yyyy%] |
Subscribe to the Tech-Recipes Newsletter
You can get tips like this delivered in your email every week!
We will never, ever sell your email address or spam you.
Related recipes:
Supress Responses From Commands In Batch Files
Using variables in Windows batch files
Supressing Prompts In Batch Files While Deleting All Files
Date Calculation In Batch Files XP/2000
Batch Files : Get users default printer via registry (WinXP)
XP batch files: Create variable for current user account and find current user
XCOPY command : Using the /EXCLUDE flag
Batch File Converting of Video Files: SageTV example
Create Batch File to Start or End Window Services
Windows XP/Vista: Use a Batch File for Quickly Restarting explorer.exe
Sponsored links
Login
Don't have an account yet? You can create one. As a registered user you have some advantages like theme manager, comments configuration and post comments with your name.Search
Tech Recipes
· Home
· Mac OS X
· Solaris
· Windows
· Programming
· UNIX
· Cisco
· MySQL
· Google
· Instant messaging
· Add recipes
· Leave feedback
· Recommend us
· RSS Syndication
Hot recipes
XP: Small, Free Way to Use and Mount Images (ISO files) Without Burning Them
Firefox 3: Display Search Results in New Tab
How Do I Use or Open Bin, Cue, or ISO Files?
Make XP look like Windows Vista / Longhorn for free!
MySpace Hack: View Pictures and Comments on a Private Profile
Vista: Should I Install 64-bit or 32-bit Version? (x64 vs x86)
Hacks to Beat Rapidshare Download Limits and Waiting Time
SMS through E-Mail: Cingular, Nextel, Sprint, T-Mobile, Verizon, Virgin Mobile
Who's Online
There are currently, 2051 guest(s) and 3 member(s) that are online.
You are Anonymous user. You can register for free by clicking here
Information
Wish to advertise with us?
All logos and trademarks in this site are property of their respective owner. The comments and forum posts are property of their posters, all the rest © 2003-2007 by QD Ideas, LLC.
Users of this site are legally bound by the Terms and conditions and Disclaimer. Do not use this web site if you do not agree with these policies.
The members, admins, and authors of this website respect your privacy.
Page Generation: 2.03 Seconds
Sun Jul 20 17:50:04 2008