Computer Hope

Microsoft => Microsoft DOS => Topic started by: Randy Bonn on October 25, 2004, 07:28:27 AM

Title: Batch file to copy from local drive to net share.
Post by: Randy Bonn on October 25, 2004, 07:28:27 AM
I have the following batch file that I would like to modify too copy the files that it lists in the Allfiles.txt file to the U:\. Can anyone assist with the proper syntax.

c:
dir c:\*.doc, *.xls, *.ppt, *.pab, *.pst, *.mab, *.rtf, *.pdf, *.mdb /s /b>c:\Cdrive.txt
d:
dir d:\*.doc, *.xls, *.ppt, *.pab, *.pst, *.mab, *.rtf, *.pdf, *.mdb /s /b>c:\Ddrive.txt
e:
dir e:\*.doc, *.xls, *.ppt, *.pab, *.pst, *.mab, *.rtf, *.pdf, *.mdb /s /b>c:\Edrive.txt

c:
type cdrive.txt>allfiles.txt
type ddrive.txt>>allfiles.txt
type edrive.txt>>allfiles.txt

u:
md MyDocs_oldPC

cd MyDocs_oldPC

md %username%

cd %username%

md favorites
md personal
md desktop


c:

cd\

cd winnt\profiles\%username%

xcopy /s favorites u:\mydocs_oldpc\%username%\favorites
del /Q /s favorites
Title: Re: Batch file to copy from local drive to net sha
Post by: scruge on October 25, 2004, 07:46:14 AM
its been awhile since i used the "FOR IN DO"  but i think you can copy using it ex.

FOR c:\*.pdf DO copy d:\*.*

I've never worked with the IN set so I'm not sure how the set must be structured.