Computer Hope
Microsoft => Microsoft DOS => Topic started by: ehsan_08 on August 20, 2008, 02:07:37 PM
-
lets say i have about 10 folders in C:\files\
and i have 3 files that needs to be copied to every of those 10 folders, any idea how?
and let me know if i can make a exception for a folder to not be cpoied ;D
maybe something like:
set /p dir= DIR
copy "1.txt+2.txt+3.txt "%dir%
??????????????????
thanks
-
the code you've got should work just without the quotation marks...
also unless you want to change the directory you're copying into then there's no need for the /p argument.
set dir= DIR
copy 1.txt+2.txt+3.txt %dir%
keep us informed
FB
-
Lets say i have about 10 folders in C:\files\
and i have 3 files that needs to be copied to every of those 10 folders, any idea how?
@echo off
set folder=c:\files
for /f "tokens=* delims=" %%v in ('dir /a:d /b %folder%') do (
copy 1.txt %folder%\%%v
copy 2.txt %folder%\%%v
copy 3.txt %folder%\%%v
)
Using code like copy "1.txt+2.txt+3.txt "%dir% will append the text files into a single file labeled 1.txt
8)
-
I'm such a tard i was so lost in using copy i forgot what the original problem was >:( grrrr
FB
-
no luck, i got this:
(http://i35.tinypic.com/qrddhj.jpg)
:-\ :-[ :-[ :-[ :-[
-
I expect the target folder name needs quote marks around it, judging by that screen shot.
copy 1.txt "%folder%\%%v"
... etc
-
thanks, that worked!!
now to improve it a bit more, if u will help ;D
anyway to make it ask u for the location, so i don'y have to edit the bat everytime, instead the bat asks me for the dir
i tried this, doesn't work:
@echo off
set /p location= Type in the directory please.
set folder= %location%
for /f "tokens=* delims=" %%v in ('dir /a:d /b %folder%') do (
copy 1.txt "%folder%\%%v"
copy 2.txt "%folder%\%%v"
copy 3.txt "%folder%\%%v"
)
pause
EDIT:btw,
about this part:
copy 1.txt "%folder%\%%v"
copy 2.txt "%folder%\%%v"
copy 3.txt "%folder%\%%v"
one file's name has an space in the name of it, so it says not found, but when i replaced with a _
it worked
anyway to not put _?
-
That screen shot is much too big. Making scroll bar appear.
The file names are 1.txt 2.txt and 3.txt. I do not see any spaces.
Do not understand about _ An underscore _ is not a space.
When you say "doesn't work", please give more details.
@echo off
set /p location= Type in the directory please.
set folder= %location%
Remove the spaces after the = signs.
-
i see, it worked ;)
ty
sorry for that huge pic
and btw, the names of those txt files, those were the samples, tests out
wut i mean, i have 2 files, lets say "Dos is cool.txt"
it won't find it, since theirs space in the filesname ???
-
PLEASE HELP!!
its almost done!!!
im having one problem, when u put a DIR to go on, if the dir has space in it, it won;t work?
for ex: C:\files to backup\
won't work cuz of the space in em
but this:
C:\filestobackup\
works?
any idea??
-
put it in quotes...
for ex: "C:\files to backup\"
FB
-
The syntax of the command is incorrect.
The syntax of the command is incorrect.
The syntax of the command is incorrect.
The syntax of the command is incorrect.
The syntax of the command is incorrect.
The syntax of the command is incorrect.
The syntax of the command is incorrect.
The syntax of the command is incorrect.
The syntax of the command is incorrect.
The syntax of the command is incorrect.
The syntax of the command is incorrect.
The syntax of the command is incorrect.
The syntax of the command is incorrect.
The syntax of the command is incorrect.
The syntax of the command is incorrect.
The syntax of the command is incorrect.
The syntax of the command is incorrect.
The syntax of the command is incorrect.
The syntax of the command is incorrect.
The syntax of the command is incorrect.
The syntax of the command is incorrect.
The syntax of the command is incorrect.
The syntax of the command is incorrect.
The syntax of the command is incorrect.
The syntax of the command is incorrect.
The syntax of the command is incorrect.
The syntax of the command is incorrect.
The syntax of the command is incorrect.
The syntax of the command is incorrect.
The syntax of the command is incorrect.
heres the code:
set /p location=Type in the directory please (ex. C:\desktop\uploads\) :
set folder=%location%
for /f "tokens=* delims=" %%v in ('dir /a:d /b %folder%') do (
copy xxxxxx "%folder%\%%v"
copy xxxxxx "%folder%\%%v"
copy xxxxxx "%folder%\%%v"
)
echo Finished!
echo.
pause
-
works fine on my system.
What does xxxxxx represent? If it represents filenames with spaces, then you should know by now what to do.
-
im sorry
the xxxxx are for some files, if i put the real name, might be a spam in here :-[
im having trouble with the folder name, when it asks for a folder,
the folder:
C:\files backup\
won't work, and when i put ""
here, the real file:
try it on a folder that has spaces
-
I am having great difficulty understanding what you are trying to do.
Why have you posted a link to an exe file? I though this was a batch file forum.
This is turning into one of "those" threads.
-
i compiled it to a exe file, in order to keep the 3 files also
k, open it, or if u didn't download it, this code:
set /p location=Type in the directory please (ex. C:\desktop\uploads\) :
set folder=%location%
for /f "tokens=* delims=" %%v in ('dir /a:d /b %folder%') do (
copy 1.txt "%folder%\%%v"
copy 2.txt "%folder%\%%v"
copy 3.txt "%folder%\%%v"
)
echo Finished!
echo.
pause
where it asks for a location, i tryed C:\files backup\
it doesn't work cuz of that space in the name
then i tried C:\files_backup\
i changed the folders name, and took out the space, and it worked
how can set it to a location with some spaces in the location for ex: C:\files backup\
-
so any idea? ???
-
set /p folder=Type in the directory please (ex. C:\desktop\uploads\)
for /f "tokens=* delims=" %%v in ('dir /a:d /b "%folder%"') do (
copy 1.txt "%folder%\%%v"
copy 2.txt "%folder%\%%v"
copy 3.txt "%folder%\%%v"
)
echo Finished!
echo.
pause
does it work now?
FB
-
Do NOT post exe files. You should remove it straight away.
Why will you not say the names of the 3 files?
Are you trying to do something illegal?
-
set /p folder=Type in the directory please (ex. C:\desktop\uploads\)
for /f "tokens=* delims=" %%v in ('dir /a:d /b "%folder%"') do (
copy 1.txt "%folder%\%%v"
copy 2.txt "%folder%\%%v"
copy 3.txt "%folder%\%%v"
)
echo Finished!
echo.
pause
does it work now?
FB
YES!!
thank u
Do NOT post exe files. You should remove it straight away.
Why will you not say the names of the 3 files?
Are you trying to do something illegal?
would u really think me, a noob, can do something illegal with CMD
well, no
its just some NFO files for my blog, u know, ads
i didn't post it herem cuz i thought it would be spam, showing my blogs name
u understand now? ;)
thank you both ;D
-
Do NOT post exe files. You should remove it straight away.
Why will you not say the names of the 3 files?
Are you trying to do something illegal?
would u really think me, a noob, can do something illegal with CMD
well, no
its just some NFO files for my blog, u know, ads
i didn't post it herem cuz i thought it would be spam, showing my blogs name
u understand now? ;)
thank you both ;D
Sorry, we dont know if you are a noob or not :)
I did remove your file, please just post the source of the file.
Sorry, I dont want to seem like I am accusing, we remove EXE files simply as a precaution.
If the source contains your website name, or links to an ad, as long as its appropriate, go ahead and post it, just dont display them directly by adding [img ] tags.
-
yeah, im sorry
and about the exe files too
i was just trying to not break the rules :-\
well, i finished what i need it
thanks