| 1. |
Solve : How to create a file sorter!? |
|
Answer» Let's say you had more then 15,000 files. Ehm.. I think Windows XP or 2K???No Version of Windows allows you to specify multiple source files with the copy command- except through the use of wildcards with the one source parameter that can be used. I was using wildcards in the original post Aww... The script has broken downhill... The "copy" should be "move" Quote from: simplyTechy100 on February 17, 2014, 05:10:22 AM I was using wildcards in the original postQuote from: BC_Programmer on February 17, 2014, 05:08:42 AM No Version of Windows allows you to specify multiple source files with the copy command- except through the use of wildcards with the one source parameter that can be used.You can only specify one source parameter. If you specify more than one source parameter you will receive a "The Syntax of the command is incorrect". All of your examples specify multiple destination filenames and do not work as a result. Quote from: simplyTechy100 on February 17, 2014, 05:12:01 AM Aww... The script has broken downhill...Move has the same limitation, and emits the same error message if you try it.Quote from: simplyTechy100 on February 17, 2014, 04:59:42 AM Ehm.. I think Windows XP and up. Or 2K and up? I don't knowSure glad you tested your code before posting it. It's true that move and copy do not accept multiple file specs, HOWEVER you can use the for instruction to feed those commands the file specs one at a TIME: Code: [Select]@echo off mkdir Documents mkdir Pictures mkdir Music mkdir Videos for %%i in (*.txt *.docx) do copy "%%i" Documents for %%i in (*.gif *.png *.tif *.tiff *.bmp) do copy "%%i" Pictures for %%i in (*.wav *.wma *.mp3) do copy "%%i" Music for %%i in (*.mp4 *.wmv) do copy "%%i" Videos Be aware those MD commands will create sub-folders under the current folder. Maybe you meant to do this. Code: [Select]for /f "delims=" %%G in ('dir /a-d /b *.txt *.doc') do copy "%%~G" DocsQuote from: Squashman on February 17, 2014, 06:10:18 AM Sure glad you tested your code before posting it. +1 Both methods worked so I went with simple. Quote from: Sidewinder on February 17, 2014, 07:01:07 AM Both methods worked so I went with simple.Your code is PROBABLY the preferred method. Just force of habit for me to always use the DIR command.Thank you everyone. I didn't even know the command for Thanks guys. Do this: Code: [Select]@echo off md Documents md Pictures md Music md Videos md Misc for %%i in (*.txt *.doc *.rtf *.docx) do copy "%%i" Documents for %%i in (*.gif *.png *.bmp *.tif *.tiff) do copy "%%i" Pictures for %%i in (*.wav *.mp3 *.wma) do copy "%%i" Music for %%i in (*.mp4 *.wmv) do copy "%%i" Videos for %%i in (*.exe *.bat *.com *.zip *.pif *.dll *.bak) do copy "%%i" MiscI added a Misc folder in case you need more stuff copied |
|