I want to take this:
(it gives me [tt]invalid escape sequence (valid ones are \b \t \n \f \r \'' \' \\)[/tt]
and use that location to find a folder and count the files in it. I will always know the name and location, how can I use this information to do what I need? Here's the code for ScannedImageFolder.
What I need to do is if there are more than 12000 files in the folder create a new folder (by incrementing the current one) and set a dataarea on our AS400 to that value (I know how to do this part, I just haven't coded it yet).
So what I'm stuck on is taking my path and using it as a location! What do I need to be doing?
Thanks!
Leslie
Have you met Hardy Heron?
Code:
ScannedImageFolder test = new ScannedImageFolder("\\srvimaging\imaging\Citation\Citationimages\00000078");
(it gives me [tt]invalid escape sequence (valid ones are \b \t \n \f \r \'' \' \\)[/tt]
and use that location to find a folder and count the files in it. I will always know the name and location, how can I use this information to do what I need? Here's the code for ScannedImageFolder.
Code:
import java.io.*;
public class ScannedImageFolder {
private File currentFolder;
private int imageCount;
private boolean timeToChange = false;
ScannedImageFolder(String c){
currentFolder = new File(c);
imageCount = getImageCount(currentFolder);
settimeToChange();
}
public File getCurrentFolder (){
return currentFolder;
}
public void setCurrentFolder(String c){
currentFolder = new File(c);
}
private int getImageCount(File file) {
if (!file.isDirectory())
{
return 1;
}
int count = 0;
File[] files = file.listFiles();
if (files != null)
{
for (File f: files)
{
count += getImageCount(f);
}
}
return count;
}
private void settimeToChange () {
if (imageCount > 12000){
timeToChange = true;
}
}
}
What I need to do is if there are more than 12000 files in the folder create a new folder (by incrementing the current one) and set a dataarea on our AS400 to that value (I know how to do this part, I just haven't coded it yet).
So what I'm stuck on is taking my path and using it as a location! What do I need to be doing?
Thanks!
Leslie
Have you met Hardy Heron?