Click here to Skip to main content
14,355,411 members

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

Rate this:
2.20 (10 votes)
Please Sign up or sign in to vote.
2.20 (10 votes)
4 Oct 2007
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

Share

About the Author

tahouri
Iran (Islamic Republic of) Iran (Islamic Republic of)
No Biography provided

Comments and Discussions

 
GeneralBug Pin
Ninjabear1-Aug-08 6:51
memberNinjabear1-Aug-08 6:51 
GeneralRe: Bug Pin
tahouri4-Sep-10 3:08
membertahouri4-Sep-10 3:08 
GeneralGreat! Pin
Ninjabear1-Aug-08 6:21
memberNinjabear1-Aug-08 6:21 
GeneralFormatting integer Pin
J a a n s4-Oct-07 4:03
professionalJ a a n s4-Oct-07 4:03 
GeneralRe: Formatting integer Pin
stancrm4-Oct-07 4:46
memberstancrm4-Oct-07 4:46 
GeneralRe: Formatting integer Pin
tahouri27-Jul-08 7:47
membertahouri27-Jul-08 7:47 

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

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

Article
Posted 4 Oct 2007

Stats

39.3K views
392 downloads
10 bookmarked