Link to home
Start Free TrialLog in
Avatar of robclarke41
robclarke41

asked on

Script to calculate how much I can fit on a disk?

Hi There,

Basically I have a large network disk 10TBs.

Occasionally I want to back this up to two 5TB USB disks.

Every time I do this I have to try and find out how much I can fit on the first disk - basically by trial and error.  i.e. I select a load of folders (all in alphabetical order) from say Australia to Denmark then check the size.  I want to fill the first disk as much as possible.  If I don't fill the disk enough or have too much data I will select and check the size again.

Is there any way I could script this so that when I tell the script the size of the first disk it returns something like:

on this 5TB disk you can fit from Australia to Latvia.

Hope that makes sense any help greatly appreciated!

Regards

Rob
Avatar of Qlemo
Qlemo
Flag of Germany image

What about a script doing the copy?
Do you want to have each folder on exact one of both disks only?
Avatar of Bill Prew
Bill Prew

We could probably adapt some of the code in this prior solution:

https://www.experts-exchange.com/questions/27482608/MSDOS-or-Pearl-or-VB-Script-or-Jscriptt-to-check-the-file-size-and-disk-space-and-send-the-alert.html?anchorAnswerId=ccepted-solution#accepted-solution

It only copied one file after checking if it fit, but with a little adjustment we could process multiple files to two locations.  A few questions though:

Do you care about optimization at all?  Meaning, if we just process folders alphabetically say, when we get to the next folder that wont fit on the first destination, we will start sending to the second.  But there could be a smaller folder after the one that didn't fit that would fit.  Do you care?

There are plenty of utilities that exist for this purpose, have you looked at / considered any of those, or does this have to be a "no install" scripting solution?

~bp
Avatar of robclarke41

ASKER

Hi Qlemo,
I can handle the copy but if you know of a way of integrating it with a script that would be perfect :)

I want to fill the first disk with as much as can fit on it from the network share.  Once the first part is calculated it is easy for me to see what's left and just copy it over to the second disk. i.e. the script works out I can copy from Australia to Canada on my 5TB disk and then I can just copy everything after Canada to the second disk.

Hi Bill,
Thanks for this I'll take a look at the script and see if I can use it.

I don't care about optimisation at all, all I want is to get as much as will fit on the disk alphabetically from the share.

I always prefer a scripted solution if possible, I'm guess an installed app would be overkill for what I need?

Thanks for your replies guys!
Are the two drives both connected when you start, with different drive letters, or do you have to swap them when one is full, and they use the same drive letter?

Are you copying from the root of the large drive to the root of the backup drives, meaning the folders are in the root of the large drive, and getting copied to the same place on the USB drives?

~bp
Hi Bill,

Both drives will use the same drive letter I just swap them when one is full.

I am copying from the root of the large drive (mapped drive) i.e X: to a folder on the USB i.e F:\Countries

Thanks for your help so far!

Rob
SOLUTION
Avatar of Qlemo
Qlemo
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks guys will test both solutions, hopefully at lunchtime and get back to you. Thanks for all your help so far!