I have a script that will find all pst files on a drive and backup to a network folder. The 2 issues i have come across is
1. duplicate file names
2. running the scriped from a mapped drive. When running the script from a mapped drive IE. p: it will only search that drive not the local drive c:
Here is the code i have.
:input
@Echo Please enter the SSO # to backup PST Files
@set EU=
@set /P EU=Type input: %=%
@if "%EU%"=="" goto input
:: pst copy
cd c:\
dir /s /b *.pst >c:\pst.txt
setlocal enabledelayedexpansion
for /f "delims=" %%a in (c:\pst.txt) do (xcopy "%%a" "\\network drive\geo\%EU%\" /E /I /Q /Y)
del /q c:\pst.txt
endlocal
Any help would be greatly appreciated.
issues with batch find and file backup to mapped drive
Moderator: DosItHelp
-
- Posts: 4
- Joined: 23 Jan 2012 03:55
Re: issues with batch find and file backup to mapped drive
When changing the DRIVE and path you have to use the /D switch with the CD command.
I usually prefer to just use the PUSHD command instead.
I usually prefer to just use the PUSHD command instead.
Re: issues with batch find and file backup to mapped drive
Why didn't you use a FOR /R like you posted in this thread.
viewtopic.php?f=3&t=2763&p=13020#p13020
Or you could put the DIR command into the FOR loop instead of writing the output to a text file.
viewtopic.php?f=3&t=2763&p=13020#p13020
Or you could put the DIR command into the FOR loop instead of writing the output to a text file.
Code: Select all
cd /d C:\
for /f "delims=" %%a in ('dir /a-d /s /b *.pst') do (xcopy "%%a" "\\network drive\geo\%EU%\" /E /I /Q /Y)
Last edited by Squashman on 23 Jan 2012 08:47, edited 1 time in total.
-
- Posts: 4
- Joined: 23 Jan 2012 03:55
Re: issues with batch find and file backup to mapped drive
Thank you Squashman. A fresh set of eyes done the trick. i don't know why i didn't think of that. adding the /D done the trick thank you 

-
- Posts: 4
- Joined: 23 Jan 2012 03:55
Re: issues with batch find and file backup to mapped drive
Now the only issue i have is the duplicate names when it saves to the network folder. Anyone have any idea's?