Skip to Content
0
Former Member
Jan 10, 2011 at 12:47 PM

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

87 Views

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