robocopy size issues

S

scott.elder

Hi all, I'm trying to create a batch file for a network backup routine.
When the user runs the batch file, it determines it's ip address range
and looks up the appropriate ip address of the computer it's going to
backup to.
I'm using robocopy to do a mirror copy on the directory but I want to
be able to check how much data is to be copied and wether there's
actually enough free space on the network drive that it's copying to.
If there's not enough space it needs to come up with the appropriate
message, and if there is enough free space, continue with the copy
operation. If the directory being mirrored is already present on the
network drive, it will obviously have to a) find out the size of the
directory on the network drive and b) add that to the 'free space'
figure when making it's calculation to determine if there's enough free
space on the network drive.
Any ideas?

Thanks in advance for your time.
 
P

Pegasus \(MVP\)

Hi all, I'm trying to create a batch file for a network backup routine.
When the user runs the batch file, it determines it's ip address range
and looks up the appropriate ip address of the computer it's going to
backup to.
I'm using robocopy to do a mirror copy on the directory but I want to
be able to check how much data is to be copied and wether there's
actually enough free space on the network drive that it's copying to.
If there's not enough space it needs to come up with the appropriate
message, and if there is enough free space, continue with the copy
operation. If the directory being mirrored is already present on the
network drive, it will obviously have to a) find out the size of the
directory on the network drive and b) add that to the 'free space'
figure when making it's calculation to determine if there's enough free
space on the network drive.
Any ideas?

Thanks in advance for your time.

You could do something like this:

Line1 @echo off
Line2 for /F "tokens=3" %%a in ('dir /s "C:\Some Folder" /-c ^| find /i
"File(s)"') do set req=%%a
Line3 set /a req=%req% / 1000000
Line4
Line5 for /F "tokens=3" %%a in ('dir /s "X:\Some Folder" /-c ^| find /i
"File(s)"') do set used=%%a
Line6 set /a used=%used% / 1000000
Line7
Line8 for /F "tokens=3" %%a in ('dir X:\ /-c ^| find /i "bytes free"')
do set free=%%a
Line9 set /a free=%free% / 1000000
Line10
Line11 set /a avail=%free% + %used%
Line12 if %avail% GTR %req% robocopy . . . /purge

Post again if you need further details.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top