Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Application Programming › [VB.NET] Copy files in a folder depending on file size
New Posts  All Forums:Forum Nav:

[VB.NET] Copy files in a folder depending on file size

post #1 of 7
Thread Starter 
Hi OCN members smile.gif

I'm trying to make a little app that will scan our shared drive (X:) and copy all the AVI and MP4 files that are over 100MB to a folder on my C drive.
The point of this is to convert them into a smaller size to save space and it gets tiring scanning that drive everyday for files and copying them back and fourth.
Any ideas on how to do it? I've tried using the FileInfo.Length and FileCopy but that only works with one file and cannot find a way to make it work with multiple files.

If you need any more information then just ask smile.gif
post #2 of 7
Quote:
Originally Posted by fleXx View Post

tried using the FileInfo.Length and FileCopy but that only works with one file and cannot find a way to make it work with multiple files.

You just need to recursively / loop around the directory.

http://support.microsoft.com/kb/303974
from site.
Code:
void DirSearch(string sDir) 
{
        try     
        {
           foreach (string d in Directory.GetDirectories(sDir)) 
           {
                foreach (string f in Directory.GetFiles(d, txtFile.Text)) 
                {
                   lstFilesFound.Items.Add(f);[B]  // you can then search this list for the files with a for loop.[/B]
                }
                DirSearch(d);
           }
        }
        catch (System.Exception excpt) 
        {
                Console.WriteLine(excpt.Message);
        }
}
Andr3w's RiG
(16 items)
 
   
CPUMotherboardGraphicsRAM
Intel Core i7 920 @ 4.0 (HT off) ASUS P6TD Deluxe EVGA GTX 580 SC 6GB Corsair XMS3 1600 
Hard DriveCoolingCoolingCooling
2x RAID0 OCZ VERTEX2 SSD 60GB EK FC580GTX EK Supreme HF Laing D5 
OSMonitorKeyboardPower
Windows 7 64 bit / Fedora 16 / Mint 13 DELL S2209W Ducky 9008S MX RED with white LED CORSAIR AX850 
CaseMouseMouse PadOther
Antec 1200 Microsoft X8 Steelseries QcK Pro Creative XFi 
CPUGraphicsRAMHard Drive
Core i7 @ 2.6  GT650 16GB of 1600 MHz DDR3L SDRAM 256GB SSD 
OSMonitorKeyboard
Mac OSX Lion Retina Display US layout 
  hide details  
Reply
Andr3w's RiG
(16 items)
 
   
CPUMotherboardGraphicsRAM
Intel Core i7 920 @ 4.0 (HT off) ASUS P6TD Deluxe EVGA GTX 580 SC 6GB Corsair XMS3 1600 
Hard DriveCoolingCoolingCooling
2x RAID0 OCZ VERTEX2 SSD 60GB EK FC580GTX EK Supreme HF Laing D5 
OSMonitorKeyboardPower
Windows 7 64 bit / Fedora 16 / Mint 13 DELL S2209W Ducky 9008S MX RED with white LED CORSAIR AX850 
CaseMouseMouse PadOther
Antec 1200 Microsoft X8 Steelseries QcK Pro Creative XFi 
CPUGraphicsRAMHard Drive
Core i7 @ 2.6  GT650 16GB of 1600 MHz DDR3L SDRAM 256GB SSD 
OSMonitorKeyboard
Mac OSX Lion Retina Display US layout 
  hide details  
Reply
post #3 of 7
Thread Starter 
Isn't that code in C though? I need a VB version tongue.gif thanks
post #4 of 7
Quote:
Originally Posted by fleXx View Post

Isn't that code in C though? I need a VB version tongue.gif thanks

Its c#. But I was more posting that as a consept/general design.

I have no interest in VB or C# to be honest, both are useless, don't see the point in C#, for running in vm java is fine plus is xplatform. And VB erh. why?
Andr3w's RiG
(16 items)
 
   
CPUMotherboardGraphicsRAM
Intel Core i7 920 @ 4.0 (HT off) ASUS P6TD Deluxe EVGA GTX 580 SC 6GB Corsair XMS3 1600 
Hard DriveCoolingCoolingCooling
2x RAID0 OCZ VERTEX2 SSD 60GB EK FC580GTX EK Supreme HF Laing D5 
OSMonitorKeyboardPower
Windows 7 64 bit / Fedora 16 / Mint 13 DELL S2209W Ducky 9008S MX RED with white LED CORSAIR AX850 
CaseMouseMouse PadOther
Antec 1200 Microsoft X8 Steelseries QcK Pro Creative XFi 
CPUGraphicsRAMHard Drive
Core i7 @ 2.6  GT650 16GB of 1600 MHz DDR3L SDRAM 256GB SSD 
OSMonitorKeyboard
Mac OSX Lion Retina Display US layout 
  hide details  
Reply
Andr3w's RiG
(16 items)
 
   
CPUMotherboardGraphicsRAM
Intel Core i7 920 @ 4.0 (HT off) ASUS P6TD Deluxe EVGA GTX 580 SC 6GB Corsair XMS3 1600 
Hard DriveCoolingCoolingCooling
2x RAID0 OCZ VERTEX2 SSD 60GB EK FC580GTX EK Supreme HF Laing D5 
OSMonitorKeyboardPower
Windows 7 64 bit / Fedora 16 / Mint 13 DELL S2209W Ducky 9008S MX RED with white LED CORSAIR AX850 
CaseMouseMouse PadOther
Antec 1200 Microsoft X8 Steelseries QcK Pro Creative XFi 
CPUGraphicsRAMHard Drive
Core i7 @ 2.6  GT650 16GB of 1600 MHz DDR3L SDRAM 256GB SSD 
OSMonitorKeyboard
Mac OSX Lion Retina Display US layout 
  hide details  
Reply
post #5 of 7
Thread Starter 
Because im just starting out and I need a basic language, I've looked at python but it looks like it doesn't really work out for application programming
post #6 of 7
Quote:
Originally Posted by fleXx View Post

Because im just starting out and I need a basic language, I've looked at python but it looks like it doesn't really work out for application programming

Learn java then (look at c/c++ after). vb is a waste of time.
Andr3w's RiG
(16 items)
 
   
CPUMotherboardGraphicsRAM
Intel Core i7 920 @ 4.0 (HT off) ASUS P6TD Deluxe EVGA GTX 580 SC 6GB Corsair XMS3 1600 
Hard DriveCoolingCoolingCooling
2x RAID0 OCZ VERTEX2 SSD 60GB EK FC580GTX EK Supreme HF Laing D5 
OSMonitorKeyboardPower
Windows 7 64 bit / Fedora 16 / Mint 13 DELL S2209W Ducky 9008S MX RED with white LED CORSAIR AX850 
CaseMouseMouse PadOther
Antec 1200 Microsoft X8 Steelseries QcK Pro Creative XFi 
CPUGraphicsRAMHard Drive
Core i7 @ 2.6  GT650 16GB of 1600 MHz DDR3L SDRAM 256GB SSD 
OSMonitorKeyboard
Mac OSX Lion Retina Display US layout 
  hide details  
Reply
Andr3w's RiG
(16 items)
 
   
CPUMotherboardGraphicsRAM
Intel Core i7 920 @ 4.0 (HT off) ASUS P6TD Deluxe EVGA GTX 580 SC 6GB Corsair XMS3 1600 
Hard DriveCoolingCoolingCooling
2x RAID0 OCZ VERTEX2 SSD 60GB EK FC580GTX EK Supreme HF Laing D5 
OSMonitorKeyboardPower
Windows 7 64 bit / Fedora 16 / Mint 13 DELL S2209W Ducky 9008S MX RED with white LED CORSAIR AX850 
CaseMouseMouse PadOther
Antec 1200 Microsoft X8 Steelseries QcK Pro Creative XFi 
CPUGraphicsRAMHard Drive
Core i7 @ 2.6  GT650 16GB of 1600 MHz DDR3L SDRAM 256GB SSD 
OSMonitorKeyboard
Mac OSX Lion Retina Display US layout 
  hide details  
Reply
post #7 of 7
VB.NET is fine to learn application programming.

There's a lot of snobbishness regarding Visual Basic (and given the early versions, you'd be right). But these days it's a pretty powerful language.
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Application Programming
Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Application Programming › [VB.NET] Copy files in a folder depending on file size