02 August 2011 ~ 0 Comments

DOS Quick File Organizer and Mover

REM ## this is a script I use sometimes to organize the mess that becomes of some of my dev folders. Seems I don't have the patience and/or organization skills to properly organize files at the time of writing them...so this helps me create some organization for files that have become a jumbled mess. It isn't well coded using vars to easily amend, but you can adjust all of the files and folders as you see below. To use, just drop this into a folder that needs organiztion and click. By Stacey Tipton Reiman, www.akwebgenius.com/blog ##

@echo off

setlocal ENABLEDELAYEDEXPANSION&pushd %~dp0

for %%* in (.) do  (
@echo %%~n*
set myvar=%%~n*
)

if not exist aaFLAS mkdir aaFLAS
if not exist pngs mkdir pngs
if not exist jpgs mkdir jpgs
if not exist gifs mkdir gifs
if not exist html mkdir html
if not exist graphics mkdir graphics
if not exist pdfs mkdir pdfs
if not exist zips mkdir zips
if not exist txts mkdir txts
if not exist spreadsheets mkdir spreadsheets

set fileoutta=filesmoved.xml

for %%* in (.) do  (
@echo %%~n*

for /f "tokens=1,2 delims=." %%a  in ( 'dir /o:n /l /b  /n *')  do ( 

if %%b==jpg (
set jpg=%%a.jpg
set /a Cnt+=1
echo hey let's move this file: %%a.jpg  >> !fileoutta!
)
if %%b==jpeg (
set jpeg=%%a.jpeg
set /a Cnt+=1
echo hey let's move this file: %%a.jpeg  >> !fileoutta!
)
if %%b==png (
set png=%%a.png
set /a Cnt+=1
echo hey let's move this file: %%a.png >> !fileoutta!
)
if %%b==ai (
set ai=%%a.ai
set /a Cnt+=1
echo hey let's move this file: %%a.ai  >> !fileoutta!
)
if %%b==psd (
set psd=%%a.psd
set /a Cnt+=1
echo hey let's move this file: %%a.psd  >> !fileoutta!
)
if %%b==edx (
set edx=%%a.edx
set /a Cnt+=1
echo hey let's move this file: %%a.edx  >> !fileoutta!
)
if %%b==gif (
set gif=%%a.gif
set /a Cnt+=1
echo hey let's move this file: %%a.gif  >> !fileoutta!
)
if %%b==pdf (
set pdf=%%a.pdf
set /a Cnt+=1
echo hey let's move this file: %%a.pdf  >> !fileoutta!
)
if %%b==zip (
set zip=%%a.zip
set /a Cnt+=1
echo hey let's move this file: %%a.zip  >> !fileoutta!
)
if %%b==fla (
set fla=%%a.fla
set /a Cnt+=1
echo hey let's move this file: %%a.fla >> !fileoutta!
)
if %%b==as (
set as=%%a.as
set /a Cnt+=1
echo hey let's move this file: %%a.as  >> !fileoutta!
)
if %%b==swf (
set swf=%%a.swf
set /a Cnt+=1
echo hey let's move this file: %%a.swf  >> !fileoutta!
)
if %%b==htm (
set htm=%%a.htm
set /a Cnt+=1
echo hey let's move this file: %%a.htm  >> !fileoutta!
)
if %%b==html (
set html=%%a.html
set /a Cnt+=1
echo hey let's move this file: %%a.html  >> !fileoutta!
)
if %%b==txt (
set txt=%%a.txt
set /a Cnt+=1
echo hey let's move this file: %%a.txt  >> !fileoutta!
)
if %%b==csv (
set csv=%%a.csv
set /a Cnt+=1
echo hey let's move this file: %%a.csv  >> !fileoutta!
)
if %%b==xls (
set xls=%%a.xls
set /a Cnt+=1
echo hey let's move this file: %%a.xls  >> !fileoutta!
)
rem for /L %%A in (0,1,25) do Call :ToUpper !LCase:~%%A,1! !UCase:~%%A,1!

if exist !jpg! move "!jpg!" jpgs
if exist !jpeg! move "!jpeg!" jpgs
if exist !png! move "!png!" pngs
if exist !gif! move "!gif!" gifs
if exist !ai! move "!ai!" graphics
if exist !edx! move "!edx!" graphics
if exist !psd! move "!psd!" graphics
if exist !pdf! move "!pdf!" pdfs
if exist !zip! move "!zip!" zips
if exist !as! move "!as!" aaFLAS
if exist !swf! move "!swf!" aaFLAS
if exist !fla! move "!fla!" aaFLAS
if exist !htm! move "!htm!" html
if exist !html! move "!html!" html
if exist !txt! move "!txt!" txts
if exist !csv! move "!csv!" spreadsheets
if exist !xls! move "!xls!" spreadsheets

)
)

echo Great I moved !Cnt! files >> !fileoutta!

cls

endlocal

via [DOS] DOS Quick File Organizer and Mover – Pastebin.com.

Leave a Reply


4 - two =