1.

Solve : Using DIR to provide files you want to copy.?

Answer»

Ok, here's the story. I work in a spot where I need to find, and COPY the PST files. Doing search for *.pst is useful, I can find them... etc. Copying them can be a pain in the a$$. Especially when users stick them in the root of C.

I've already created a batch file for the profile, based on our backup structure, but need ONE for the PST.

Now, I KNOW I can use dir *.pst /s to FIND all the files. The ISSUE is then telling the computer (without input from me) to BACK those up. Preferabbly with the same directory structure (even less input from me)

Thanks
RadekModifying one off the examples shown at [highlight]http://dostips.cmdtips.com/DtTipsCopy.php[/highlight] should work:

Code: [Select]set sourcedir=C:\*.pst
set backupdir=D:\pstbackup
for /f "tokens=*" %%a in ('dir "%sourcedir%" /s/b') do (
xcopy "%%a" "%backupdir%.%%~pa" /Y/U
)Hope this helps



Discussion

No Comment Found