| 1. |
Solve : Duplicating-Need help Fast? |
|
Answer» I have 10 files, i need them duplicated X times, meaning, if i say 100 it will take the 10 and make 100 copies of each with UNIQUE names, even if the X is hard-coded in the script. So it's just a loop that copies the original to a new name with an increasing number. Not sure, I am new to DOS.Code: [Select]@echo off 1 file(s) copied succesfullyif it's worked or Quote 0 file(s) copiedif it's not worked. to be able to run the script from anywhere add this line just above: "set /p N=enter number of times you want to copy files: " Code: [Select]set /p J=what directory are you're files located in: cd %J% FBIts output was 0 file(s) copied. This is the current code right now. So something not happening in xcopy, and when i want to exit by hitting ctrl c, it displays "does D:\. specify a file name or directory name on the target. Even when i try to run it off of a 4NT window, it lets me type the number of copies i want, then the window disappears. @echo off setlocal ENABLEDELAYEDEXPANSION set M=1 set /p J=what directory are you're files located in: cd %J% set /p N=enter number of times you want to copy files: for /f "delims==" %%A in ('dir /b /a-d') do ( set L=%%A set O=!L:~-3! for /L %%N in (1,1,%N%) do ( xcopy "!L!" "d:\.\!L!-!M!.!O!" set /a M+=1 ) set /a M=1 ) exit presumably d:\. exists? when i try and run the script i get 'invalid path'. I don't know about escape characters for xcopy. sorry FBWell, when i run it, it asks for the directory and number of copies, then i enter the number than i get: error error error error error error error error this is the xcopy, i SORT of modified it, xcopy "!L!" "xcopy d:\*.* /a /e /k, so i just need a way for the file to copy and with the same name and incrementing number. Just as if you copy and paste, it creates . can you put Code: [Select]REM infront on @echo off to see what exactly the error message is. Also the script i gave first of all gave an output which would be the original filename with a copy number like: . !L! is the filename !M! is the copy number and !O! is the extension. FBOkay, i put that BACK, the REM displays the set m=1 and i put the path and number of copies, the script runs but it closes once it copies, where do i see if it copied the file or if it didnt copy the files REM @echo off setlocal ENABLEDELAYEDEXPANSION set M=1 set /p J=what directory are you're files located in: cd %J% set /p N=enter number of times you want to copy files: for /f "delims==" %%A in ('dir /b /a-d') do ( set L=%%A set O=!L:~-3! for /L %%N in (1,1,%N%) do ( xcopy "!L!" "d:\*.*\!L!-!M!.!O!" set /a M+=1 ) set /a M=1 ) exit either put a "pause" after the xcopy, or delete the 'exit' and run it from cmd. Also i'm still not sure what *.* is? FB |
|