batch input to organize

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Message
Author
Ed Dyreen
Expert
Posts: 1569
Joined: 16 May 2011 08:21
Location: Flanders(Belgium)
Contact:

Re: batch input to organize

#31 Post by Ed Dyreen » 01 Aug 2012 23:53

Liviu wrote:- "docx" under DOCUMENTS, "pptx" under POWERPOINT, "xlsx" under EXCEL, and "html" under INTERNET are redundant except in the rare case of an NTFS volume with NtfsDisable8dot3NameCreation=1 (otherwise for example *.doc will match .docx files, too, due to the short 8.3 name).
That would explain the redirect stderr ( no matching files ), I wasn't aware of that :shock:

Sorry for ruining everything, I just hate to see poor design, especially if it's missing code tags.

blackpete
Posts: 36
Joined: 31 Jul 2012 16:14

Re: batch input to organize

#32 Post by blackpete » 02 Aug 2012 08:26

I am back!
To Squashman, yes I have the @echo off, In the last post I just listed from the code down.
To foxidrive, I will try your suggestion "move source target >nul" to see if it take off the list of the files that were moved.Also will look for any hidden files that might be causing "A duplicate file name exist, or the file cannot be found."
To Liviu, I think that Ed Dyreen is right with the files extension, see jpeg is an image that you down from the web, the difference between doc and docx is that one is 2003 and the other is 2007, the same with excel and powerpoint.

Thanks Ed Dyreen, I am not familiar with that code, is it "C"?, and it is suppose to do the same than my bath file?

By the way: here is a list of files extensions

Photos and images:
JPG - Pictures stored in digital cameras
JPEG- on the Web (Joint Photographic Experts Group)
PNG - Portable Network Graphics
GIF - Graphics Interchange Format
BMP - Windows and OS/2 bitmap image
TIFF - Tagged Image File Format
ICO - Windows Icon
ANI - Windows Animated Cursor
CR2 - Canon RAW image
SR2 - Sony RAW image
NEF - Nikon RAW image
DCR - Kodak RAW image
PEF - Pentax RAW image
DNG - Adobe Digital Negative
SVG - Scalable Vector Graphics
PSD - Adobe Photoshop Image
RAS - Sun raster image
PSP - Paint Shop Pro image
Thumbcache - Windows thumbnail cache
IFF - Amiga images and other media
ART - AOL Art images
WMF - Windows MetaFile
EMF - Enhanced MetaFile
WMZ, EMZ - Compressed MetaFiles
DICOM - Medical imaging format
WEBP - WebP images
PCX - ZSoft PCX images
CDR - CorelDraw images
INDD - Adobe InDesign documents
CP - Adobe Captivate documents
Documents:
DOC - Microsoft Word document (2003 and below)
DOCX - Microsoft Word document (2007 and above)
XLS - Microsoft Excel spreadsheet (2003 and below)
XLSX - Microsoft Excel spreadsheet (2007 and above)
PPT - Microsoft PowerPoint presentation (2003 and below)
PPTX - Microsoft PowerPoint presentation (2007 and above)
VSD - Microsoft Visio document
PDF - Portable Document Format
XML - eXtensible Markup Language
HTML - HyperText Markup Language
RTF - Rich Text Format
WPD - WordPerfect document
WPS - Microsoft Works document
PUB - Microsoft Publisher document
XPS - XML Paper Specification
WRI - Old Windows Write document
ODT, ODS, ODP, ODG - OpenDocument formats

Audio and video:
MP3 - Audio format widely used in digital media players (MPEG layer 3)
WMA - Windows Media Audio
AVI - Audio Video Interleave
WAV - Wave audio
MID -Musical Instrument Digital Interface
FLV - Adobe Flash Video
WMV - Windows Media Video
MOV - QuickTime video
M4A - MPEG-4 audio
M4V - MPEG-4 video
3GP - Third Generation Partnership video
F4V - Adobe Flash video based on MPEG-4 Part 12
RM - RealMedia video
RMVB - RealMedia video (variable bitrate)
MKV - Matroska video
MPEG - Motion Picture Experts Group
AU - Sun Microsystems audio
MTS, M2TS - MPEG2 Transport Stream
R3D - RED Video Camera video
APE - Monkey's Audio file
OFR - OptimFROG lossless audio
PPM, PGM, PBM - Netpbm images
WEBM - WebM videos

Compressed archives:
ZIP - Widely used compressed format developed by PKWARE
RAR - Roshal ARchive, used by WinRAR
7Z - Compressed format used by 7-Zip
GZ - Compressed format used by gzip
SIT - Compressed format used by StuffIt for Mac
ACE - WinAce archive
CAB - Microsoft Cabinet archive
SZDD - Compressed files created by COMPRESS.EXE from MS-DOS

Miscellaneous:
ISO - Images of optical media, such as CDs and DVDs
EXE - Windows or MS-DOS executable file
DLL - Windows or MS-DOS dynamic-link library
MDB - Microsoft Access database (2003 and below)
ACCDB - Microsoft Access database (2007 and above)
PST - Microsoft Outlook Personal Folders file
DBX - Microsoft Outlook Express data file
XAC - GnuCash data file
KMY - KMyMoney data file
DWG - AutoCAD drawing
DXF - Drawing Interchange Format
CHM - Microsoft Compiled HTML Help file
TTF, TTC - TrueType font
CLASS - Java class file
KMZ - Google Earth location data

Squashman
Expert
Posts: 4465
Joined: 23 Dec 2011 13:59

Re: batch input to organize

#33 Post by Squashman » 02 Aug 2012 09:07

blackpete wrote:Thanks Ed Dyreen, I am not familiar with that code, is it "C"?, and it is suppose to do the same than my bath file?

Ed's code is batch. He just has a unique way of expressing it. :lol:

blackpete
Posts: 36
Joined: 31 Jul 2012 16:14

Re: batch input to organize

#34 Post by blackpete » 02 Aug 2012 12:00

Thanks to clarify that Squashman.

To foxidrive, I tried your suggestion "move source target >nul", but I think the location where I put it doesn´t belong, because I get this message after I run the code "The syntax of the command is incorrect".

Was like this: "if not exist %drive%\ORGANIZED\DOCUMENTS md %drive%\ORGANIZED\DOCUMENTS
for %%x in (doc txt docx pdf rtf vsd wpd wri) do move 2>nul /-y %drive%\*.%%x %drive%\ORGANIZED\DOCUMENTS"

now is like this:
"if not exist %drive%\ORGANIZED\DOCUMENTS md %drive%\ORGANIZED\DOCUMENTS
for %%x in (doc txt docx pdf rtf vsd wpd wri) do move source target >nul /-y %drive%\*.%%x %drive%\ORGANIZED\DOCUMENTS"

Squashman
Expert
Posts: 4465
Joined: 23 Dec 2011 13:59

Re: batch input to organize

#35 Post by Squashman » 02 Aug 2012 12:11

Post all your code again so we can see what you are using. Please use CODE tags around your code as well.

blackpete
Posts: 36
Joined: 31 Jul 2012 16:14

Re: batch input to organize

#36 Post by blackpete » 02 Aug 2012 12:23

Hello Ed Dyreen, today I tried your code, you almost got it, I use D: as I have in that root a all bunch of different documents to organize, so your program did create a folder call ORGANIZED, and all the subfolders, and it even showed me the commands for moving the different files, but when I went to check the sub-folder DOCUMENTS in the ORGANIZED folder, was empty. So, it didn´t move the files from the root D:

can tell me why?

but yes, that is what I want to do!

Thanks

Liviu
Expert
Posts: 470
Joined: 13 Jan 2012 21:24

Re: batch input to organize

#37 Post by Liviu » 02 Aug 2012 12:25

blackpete wrote:"if not exist %drive%\ORGANIZED\DOCUMENTS md %drive%\ORGANIZED\DOCUMENTS
for %%x in (doc txt docx pdf rtf vsd wpd wri) do move source target >nul /-y %drive%\*.%%x %drive%\ORGANIZED\DOCUMENTS"

"Source" and "target" were just meant as placeholders. Try this, instead.

Code: Select all

for %%x in (doc txt docx pdf rtf vsd wpd wri) do move >nul 2>nul /-y %drive%\*.%%x %drive%\ORGANIZED\DOCUMENTS"

Liviu

blackpete
Posts: 36
Joined: 31 Jul 2012 16:14

Re: batch input to organize

#38 Post by blackpete » 02 Aug 2012 12:32

Squshman: you mean the code tags above?

Code: Select all

@echo off
cls
:MENU
ECHO.
ECHO ..............................................................................................................
ECHO THIS PROGRAM WILL ORGANIZE YOUR SCATTERED FILES INTO SEPARATE FOLDERS
ECHO -------WHEN IT IS DONE, LOOK FOR A FOLDER CALLED "ORGANIZED"-------------
ECHO ..............................................................................................................
ECHO.
ECHO 1 - C:
ECHO 2 - D:
ECHO 3 - E:
ECHO 4 - F:
ECHO 5 - G:
ECHO 6 - H:
ECHO 7 - I:
ECHO 8 - EXIT
ECHO.

set drive=
set /p drive= which drive you want to organize first?
if "%drive%"=="1" (set "drive=C:"
)else if "%drive%"=="2" (set "drive=D:"
)else if "%drive%"=="3" (set "drive=E:"
)else if "%drive%"=="4" (set "drive=F:"
)else if "%drive%"=="5" (set "drive=G:"
)else if "%drive%"=="6" (set "drive=H:"
)else if "%drive%"=="7" (set "drive=I:"
)else if "%drive%"=="8" (goto :eof
) else goto :menu


if not exist %drive%\ORGANIZED\DOCUMENTS md %drive%\ORGANIZED\DOCUMENTS
for %%x in (doc txt docx pdf rtf vsd wpd wri) do move >nul 2>nul /-y %drive%\*.%%x %drive%\ORGANIZED\DOCUMENTS
if not exist %drive%\ORGANIZED\PHOTOS md %drive%\ORGANIZED\PHOTOS
for %%x in (bmp gif jpg jpeg png tiff psd psp wmf) do move >nul 2>nul /-y %drive%\*.%%x %drive%\ORGANIZED\PHOTOS
if not exist %drive%\ORGANIZED\MUSIC md %drive%\ORGANIZED\MUSIC
for %%x in (mp3 wav wma mid m4a au ape) do move >nul 2>nul /-y %drive%\*.%%x %drive%\ORGANIZED\MUSIC
if not exist %drive%\ORGANIZED\POWERPOINT md %drive%\ORGANIZED\POWERPOINT
for %%x in (ppt pptx) do move >nul 2>nul /-y %drive%\*.%%x %drive%\ORGANIZED\POWERPOINT
if not exist %drive%\ORGANIZED\EXCEL md %drive%\ORGANIZED\EXCEL
for %%x in (xls xlsx) do move >nul 2>nul /-y %drive%\*.%%x %drive%\ORGANIZED\EXCEL
if not exist %drive%\ORGANIZED\VIDEO md %drive%\ORGANIZED\VIDEO
for %%x in (wmv avi mov flv m4v rmvb mpeg) do move >nul 2>nul /-y %drive%\*.%%x %drive%\ORGANIZED\VIDEO
if not exist %drive%\ORGANIZED\INTERNET-FILES md %drive%\ORGANIZED\INTERNET-FILES
for %%x in (htm html) do move >nul 2>nul /-y %drive%\*.%%x %drive%\ORGANIZED\INTERNET-FILES

ECHO ..................................................................................................
ECHO REMEMBER, LOOK FOR FOLDER "ORGANIZED" IN THE DRIVE YOU SELECTED
ECHO ..................................................................................................
pause

Edited by Squashman to fix code tags.
Last edited by blackpete on 02 Aug 2012 13:07, edited 1 time in total.

blackpete
Posts: 36
Joined: 31 Jul 2012 16:14

Re: batch input to organize

#39 Post by blackpete » 02 Aug 2012 12:41

Hey, Hey Liviu, I change the code with what you said:
"for %%x in (doc txt docx pdf rtf vsd wpd wri) do move >nul 2>nul /-y %drive%\*.%%x %drive%\ORGANIZED\DOCUMENTS"

And it worked!

didn´t show ""The syntax of the command is incorrect", "A duplicate file name exist, or the file cannot be found.", or " the list of the files that were moved."

Just selected number 2 for D:, it created folder ORGANIZED, and all the other sub-folders, and moved all the different documents from the root of D: to the sub-folder documents.

Flawless!
Whoopy!
Now I have to complete all the other syntax, and that will be it.

blackpete
Posts: 36
Joined: 31 Jul 2012 16:14

Re: batch input to organize

#40 Post by blackpete » 02 Aug 2012 13:13

I have to really thank you all involved, I still want to see Ed Dyreen way of doing it, very neat!

And for my batch that anybody can have, I will try to dress it up with colors and maybe convert it to exe.

Big hug!

Squashman
Expert
Posts: 4465
Joined: 23 Dec 2011 13:59

Re: batch input to organize

#41 Post by Squashman » 02 Aug 2012 13:49

blackpete wrote:maybe convert it to exe.

I wouldn't waste your time with that. There is no point to doing that.

blackpete
Posts: 36
Joined: 31 Jul 2012 16:14

Re: batch input to organize

#42 Post by blackpete » 03 Aug 2012 07:25

I would like to spice it up, like a nice color windows, with buttons to push, you know?
with a batch you can´t do too much, or I am wrong?

blackpete
Posts: 36
Joined: 31 Jul 2012 16:14

Re: batch input to organize

#43 Post by blackpete » 03 Aug 2012 07:31

I added some more file extensions, and soon I will post the English and Spanish version.

blackpete
Posts: 36
Joined: 31 Jul 2012 16:14

Re: batch input to organize

#44 Post by blackpete » 03 Aug 2012 07:45

I also want to put at the end, an statement to change to the ORGANIZED folder when the batch finish.
I tried:
CD\ORGANIZED
CD %DRIVE%\ORGANIZED

What else is there?

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: batch input to organize

#45 Post by foxidrive » 03 Aug 2012 08:21

Maybe this:

Code: Select all

cd  /d "%drive%\organized"

Post Reply