Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Folder location on Server 1

Status
Not open for further replies.

lespaul

Programmer
Feb 4, 2002
7,083
0
0
US
I want to take this:
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?
 
Thanks, it took me a few minutes to realize that the problem was the single \s on the inside, for some reason I was convinced the problem was with the \\ starting the string!

Leslie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top