Problem with (a lot of) files

  • Thread starter Thread starter Moni
  • Start date Start date
M

Moni

My problem:

I have a directory with thousands of files and I would like to copy the lot
on CDs (700 mb).

Does it exists a small program that could calculate which (how many) files
go on the first CD (-/= 700 mb), then the next bunch of files for the next
CD a.s.o...

I hope you can understand me because my english is not so good
Thanks in advance for your kind help
 
See if this helps;

'// Filename: Movefiles.vbs
'//
'// Assumes:
'// 1. There is a folder named "cd1"
'//
'// - Could be changed so this is not a pre-req
'// but this is just a basic script off the top of
'// my head and is untested.
'//
'// 2. There are no sub-folders

'// Maximum size (in MB)
Const Max_Size = 650

'// Declare the variables we're going to use
Dim objFSO, objFldr, objSFldr, objFl, iSize, iCount
'// Create the object
Set objFSO = CreateObject("scripting.filesystemobject")
Set objFldr = objFSO.GetFolder("C:\WUTemp")
Set objSFldr = objFSO.GetFolder("C:\WUTemp\CD1\")
'// Move the files
For Each objFl in objFldr.Files
iSize = fGetFSize(objSFldr.Size)
If iSize < Max_Size Then
objFSO.MoveFile objFl.Path, objSFldr.Path
iCount = iCount + 1
Else
MsgBox "Folder contains approx 650MB of files"
End If
Next

Set objFldr = Nothing
Set objFSO = Nothing

Function fGetFSize(sWhat)
'// Should be on one line
'// (depending on your mail client's formatting)
fGetFSize = FormatNumber((cdbl(sWhat) /1024 /1024), 0):If fGetFSize < 1 Then fGetFSize = 1
End Function

'// End script

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!
 
Steven said:
See if this helps;

Ok, at the risk of making a great fool of myself and b/c I've seen
scripts offerred here before as solutions...
What do you do with this script? Where do you type it?
 
Copy and paste it into Notepad, and then save it with a .vbs extension (e.g. "somefile.vbs").... then just double click the file.

Note: if you have programs such as ScriptSentry, ZoneAlarm, Norton etc running, you may need to disable these first (app's that block scripts kinda defeat the object ;o)).

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!
 
See if this helps;

'// Filename: Movefiles.vbs
'//
'// Assumes:
'// 1. There is a folder named "cd1"
'//
'// - Could be changed so this is not a pre-req
'// but this is just a basic script off the top of
'// my head and is untested.
'//
'// 2. There are no sub-folders

'// Maximum size (in MB)
Const Max_Size = 650

'// Declare the variables we're going to use
Dim objFSO, objFldr, objSFldr, objFl, iSize, iCount
'// Create the object
Set objFSO = CreateObject("scripting.filesystemobject")
Set objFldr = objFSO.GetFolder("C:\WUTemp")
Set objSFldr = objFSO.GetFolder("C:\WUTemp\CD1\")
'// Move the files
For Each objFl in objFldr.Files
iSize = fGetFSize(objSFldr.Size)
If iSize < Max_Size Then
objFSO.MoveFile objFl.Path, objSFldr.Path
iCount = iCount + 1
Else
MsgBox "Folder contains approx 650MB of files"
End If
Next

Set objFldr = Nothing
Set objFSO = Nothing

Function fGetFSize(sWhat)
'// Should be on one line
'// (depending on your mail client's formatting)
fGetFSize = FormatNumber((cdbl(sWhat) /1024 /1024), 0):If
fGetFSize < 1 Then fGetFSize = 1
End Function

'// End script

I haven't tried it yet but many thanks for your time and your kind
response.

I'll try it when I'll be a little bit more aware of what I'm doing ;-)

Regards
 
Steven said:
Copy and paste it into Notepad, and then save it with a .vbs extension (e.g. "somefile.vbs").... then just double click the file.

Note: if you have programs such as ScriptSentry, ZoneAlarm, Norton etc running, you may need to disable these first (app's that block scripts kinda defeat the object ;o)).

Thankyou!
 
Back
Top