void tar()
{
    TString dir = gSystem->pwd();

    Int_t slash = dir.Last('/');

    TString name = &dir[slash+1];

    if (!gSystem->AccessPathName("../"+name+".tar"))
    {
        cout << "File '../" << name << ".tar' existing." << endl;
        return;
    }

    if (!gSystem->AccessPathName("../"+name+".tar.gz"))
    {
        cout << "File '../" << name << ".tar.gz' existing." << endl;
        return;
    }

    gSystem->cd("..");

    TString cmd = "tar cvf "+name+".tar --exclude=Root Tag "+name+"/.rootrc "+name+"/*";

    cout << "Executing: " << cmd << endl;

    gSystem->Exec(cmd);
    gSystem->Exec("gzip -9 "+name+".tar");

    gSystem->cd(name);
}
