cancel
Showing results for 
Search instead for 
Did you mean: 

Error while trying to move a file from a folder to another

Former Member
0 Kudos

Hi,

I have created an application that processes files. When a file is processed, the application moves it to another subfolder.

I am working on Netweaver Developer Studio 7.2. The application is a standard DC Web Dynpro.

The code used to move the file is the following:

File destFolder = new File(destinationFolder);

if (!destFolder.exists())
	repCible.mkdirs();

if (destFolder.exists()) {
	File fileToMove = new File(parentFolder + "\" + fileName);
	boolean isFileMoved = fileToMove.renameTo(new File(
			destinationFolder + "\" + fileName));

	disp("Etat du déplacement du fichier: " + isFileMoved);
}

The code is surrounded with a try catch to catch any SecurityException or NullPointerException. None of these exception is caught, and the isFileMoved boolean always return false.

When the destination folder does not exist, it is created but the file isn't moved. Since the files and folders are situated in a network folder, I have tried to implement the exact same code in a stand alone Java application (not WDPJ). The code works fine. What is wrong with my Web Dynpro DC ? Any thoughts ?

Thanks in advance for your help,

Thibault

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Problem solved: I used the Scanner to extract data from the files and forgot to close the scanner.

As a result, the file was still processed by thread and could not be deleted or moved !!