Click here to Skip to main content
Licence 
First Posted 4 Oct 2007
Views 21,718
Downloads 208
Bookmarked 10 times

.001,.002, ... Part Files Combiner

By | 4 Oct 2007 | Article
This program simply generates a batch file that you can extract your .00x files
Title:       .001, .002 Files Combiner
Author:      Ali Tahouri
Email:       ali_2004t@yahoo.com
Language:    C#
Platform:    Windows
Description: This program simply generates a batch file that you can extract your .00x files
Section      General C#
SubSection   Files and Folders
Screenshot - combiner.jpg

Introduction

I download a lot of files everyday (5 gigs per day) and sometimes I see some files like these (specially for the films or big files):

Godfather_CD2_W-BB_BrAd.avi.001
Godfather_CD2_W-BB_BrAd.avi.002
Godfather_CD2_W-BB_BrAd.avi.003
Godfather_CD2_W-BB_BrAd.avi.004
Godfather_CD2_W-BB_BrAd.avi.005
Godfather_CD2_W-BB_BrAd.avi.006
Godfather_CD2_W-BB_BrAd.avi.007
Godfather_CD2_W-BB_BrAd.avi.008

extracting these files are a little complex. you can use winrar to compress them once and then extract them from the new compressed file but it is very timeconsuming! with this program you can easily combine these type of files!

Using the code

For using this program you should do the followings :

0- copy the Combiner.exe to the folder that you have some .001, .002, ... files.

1- copy one of your part file's name to the clipboard. for example I copy the file named : "Godfather_CD2_W-BB_BrAd.avi.001"

2- Open the program (It automatically paste the file name in the correct place!). you write the filename yourself.

3- Enter the number of parts (in this cace I sould enter 8)

4- Press the Generate button! then a .bat file will create ! ("Godfather_CD2_W-BB_BrAd.avi.bat" in this case!) if you run that .bat file then your files will combined and the main file would created! ("Godfather_CD2_W-BB_BrAd.avi" in this case!)

THE CODE

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.IO;
using System.Windows.Forms;

namespace Combiner
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            textBox1.Text = Clipboard.GetText();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox2.Text.ToString() != "")
            {
                try
                {
                    string s = textBox1.Text.ToString();
                    string fileName = s.Substring(0, s.Length - 4);
                    int x = Convert.ToInt16(textBox2.Text.ToString());
                    FileInfo f = new FileInfo(fileName + ".bat");
                    StreamWriter w = f.CreateText();
                    w.WriteLine("Copy /b \"" + fileName + ".001" + "\" \"" + fileName + "\"\n");
                    for (int i = 2; i <= x; i++)
                        w.WriteLine("Copy /b \"" + fileName + "\" + \"" + fileName + "." + ((i >= 100) ? "" : "0") + ((i < 100 && i >= 10) ? "" : "") + ((i < 10) ? "0" : "") + i.ToString() + "\"\n");
                    w.Close();
                    MessageBox.Show("The file \"" + fileName + ".bat\" created successfully!\nuse it to extract your file!");
                }
                catch (Exception err)
                {
                    MessageBox.Show(err.ToString());
                }
            }
            else
            { MessageBox.Show("enter the number of part files!"); }
        }             
    }
}
Special thanks to you for using this product!

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

tahouri



Iran (Islamic Republic Of) Iran (Islamic Republic Of)

Member



Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralBug PinmemberNinjabear5:51 1 Aug '08  
GeneralRe: Bug Pinmembertahouri2:08 4 Sep '10  
GeneralGreat! PinmemberNinjabear5:21 1 Aug '08  
GeneralFormatting integer PinmemberJ@@NS3:03 4 Oct '07  
GeneralRe: Formatting integer Pinmemberstancrm3:46 4 Oct '07  
GeneralRe: Formatting integer Pinmembertahouri6:47 27 Jul '08  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web04 | 2.5.120517.1 | Last Updated 4 Oct 2007
Article Copyright 2007 by tahouri
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid