sorting - Moving files to different directories by file type in a batch file(Win) -


basically trying sort downloads folder batch file. need know how either make batch file overwrite duplicate files or create "(1)" @ end of file name. moving file .jpeg, jpg, etc... pictures folder , like. have this,

@echo off mkdir %userprofile%\downloads\exes mkdir %userprofile%\downloads\jars mkdir %userprofile%\downloads\zips mkdir %userprofile%\downloads\crafts mkdir %userprofile%\documents mkdir %userprofile%\downloads\iso's mkdir %userprofile%\pictures mkdir %userprofile%\downloads\torrent mkdir %userprofile%\music mkdir %userprofile%\videos mkdir %userprofile%\contacts   move %cd%\*.exe %userprofile%\downloads\exes  move %cd%\*.jar %userprofile%\downloads\jars move %cd%\*.zip %userprofile%\downloads\zips move %cd%\*.rar %userprofile%\downloads\zips move %cd%\*.gz %userprofile%\downloads\zips move %cd%\*.7z %userprofile%\downloads\zips move %cd%\*.tar.gz %userprofile%\downloads\zips move %cd%\*.craft %userprofile%\downloads\crafts move %cd%\*.pdf %userprofile%\documents move %cd%\*.doc %userprofile%\documents move %cd%\*.docx %userprofile%\documents move %cd%\*.csv %userprofile%\documents move %cd%\*.txt %userprofile%\documents move %cd%\*.iso %userprofile%\downloads\iso's move %cd%\*.img %userprofile%\downloads\iso's move %cd%\*.jpg %userprofile%\pictures move %cd%\*.jpeg %userprofile%\pictures move %cd%\*.png %userprofile%\pictures move %cd%\*.bmp %userprofile%\pictures move %cd%\*.torrent %userprofile%\downloads\torrent move %cd%\*.m3u %userprofile%\music move %cd%\*.mp4 %userprofile%\videos move %cd%\*.vcf %userprofile%\contacts echo sort completed. pause 

and while this, part, job. still have few files left behind , 12 error messages,

a duplicate file name exists, or file cannot found.

a duplicate file name exists, or file cannot found.

a duplicate file name exists, or file cannot found.

i of these messages program not finding "*.exe" , like. some, files left on should moved. have tried lot of googling , came upon things more complex need. sorry if there post this, couldn't find it. time.

the error (probably) occures, if move *.ext ... can not find file extension .ext. either

if exist *.ext move *.ext ... 

or redirect errormessage nirvana:

2>nul move *.ext ... 

if want overwrite existing files in destination: move has /y parameter, that. (although move /? suggests, move per default when running batchfile)

for remaining files suggest line @ end of batchfile (when other files have been moved):

2>nul move *.* %userprofile%\other 

Comments

Popular posts from this blog

html - Styling progress bar with inline style -

java - Oracle Sql developer error: could not install some modules -

How to use autoclose brackets in Jupyter notebook? -