@Test
public void testRecusiveCopy()
{
SRBFileExt home = new SRBFileExt(sys, sys.getHomeDirectory());
SRBFileExt testDir = new SRBFileExt(home, "TestRecursiveDir");
SRBFileExt destDir = new SRBFileExt(home, "TestRecursiveDirDestination");
if(testDir.exists())
{
//go recursive delete!
testDir.delete(true);
}
if(destDir.exists())
{
destDir.delete();
}
SRBFileExt dir = new SRBFileExt(home, "TestRecursiveDir/Folder1/Folder2/Folder3");
SRBFileExt file1 = new SRBFileExt(home, "TestRecursiveDir/Folder1/File 1");
SRBFileExt file2 = new SRBFileExt(home, "TestRecursiveDir/Folder1/Folder2/Folder3/File 3");
dir.mkdir();
try
{
file1.createNewFile();
file2.createNewFile();
}
catch(IOException ioe)
{
ioe.printStackTrace();
}
try
{
testDir.copyTo(destDir, true, true);
SRBFileExt checkFile1 = new SRBFileExt(destDir, "Folder1/File 1");
System.out.println(checkFile1.getAbsoluteFile());
SRBFileExt checkFile2 = new SRBFileExt(destDir, "Folder1/Folder2/Folder3/File 3");
System.out.println(checkFile2.getAbsoluteFile());
SRBFileExt checkFolder = new SRBFileExt(destDir, "Folder1/Folder2/");
System.out.println(checkFolder.getAbsolutePath());
assertTrue(checkFile1.exists());
assertTrue(checkFile2.exists());
assertTrue(checkFolder.exists());
}
catch(Exception e)
{
//damn it. no exception should have been thrown!