1.

Solve : Copy Doc files from Documents and Settings folder !!!?

Answer»

Hello agian,
i want to MAKE two batch file to copy all the doc files from my Documents and Settings folder, thier are many doc file i usually make and some materials from the net i download: they are scattered haphazardly in My Document folders sometimes in my download folder within My Document folder and sometimes i usually paste or save them in C: root directory.
So i want to make two batch file that will copy the doc file from the Documents and Settings folder to say F: and the second batch file to copy from C: to F:
Hope it is uderstood. I am assuming the second one would be difficult since C: also contains a huge collection from other program folder as WELL , i wouldn't mind if the doc file of other programs folder are also copied.


Thank you in advance. I believe this will work:

Code: [Select]CD C:\Documents and Settings\
XCOPY *.doc F:\ /S
CD C:\
XCOPY *.doc F:\
Quote from: John_L. on October 21, 2012, 07:28:41 PM

I believe this will work:

Code: [Select]CD C:\Documents and Settings\
XCOPY *.doc F:\ /S
CD C:\
XCOPY *.doc F:\

Hello John, i did as you did and gave the path right except i wanted the doc files in c:\Document and Settings\My Documents\ and c:\Document and Settings\My Documents\downloads to copied on f: it didn't work. Sadly, however i came up with a solution and gave this command:
Code: [Select]@ECHO off
xcopy /y "%userprofile%\Desktop\*.doc" f:
xcopy /y "%userprofile%\My Documents\*.doc" f:
xcopy /y "%userprofile%\My Documents\Downloads\*.doc" f:This worked like a charm every doc file containing in My document and Download folder as well as the Desktop got copied in F:

To go a step further i went and gave the same command and replaced the *.doc with *.txt in another line and it copied the txt file as well.
Code: [Select]@echo off
xcopy /y "%userprofile%\Desktop\*.doc" f:
xcopy /y "%userprofile%\My Documents\*.doc" f:
xcopy /y "%userprofile%\My Documents\Downloads\*.doc" f:

xcopy /y "%userprofile%\Desktop\*.txt" f:
xcopy /y "%userprofile%\My Documents\*.txt" f:
xcopy /y "%userprofile%\My Documents\Downloads\*.txt" f:
Anyways John thanks for trying to HELP, i just saw the environment variable that was set for Document and Settings folder along with the user. From their it was all good.

p.s: PATTING myself. Good work. You can use a for in do loop to copy multiple filespecs, like so:

Code: [Select]@echo off

for %%a in ( doc txt swf ini avi mp3 ) do (

xcopy /y "%userprofile%\Desktop\*.%%a" f:
xcopy /y "%userprofile%\My Documents\*.%%a" f:
xcopy /y "%userprofile%\My Documents\Downloads\*.%%a" f:
)


Discussion

No Comment Found