cancel
Showing results for 
Search instead for 
Did you mean: 

how to move a file to a different folder in webdynpro?

Former Member
0 Kudos

Hi all

i ve created a file in some folder using fileoutput stream(). now i want to delete this file from folder and copy that file into some different folder.

can anyone tell me.How to delete and move a file?

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos
try {
	File inputFile = new File("C:\test\fold1\abc.txt");
	File outputFile = new File("C:\test\fold2\def.txt");
	FileInputStream in = new FileInputStream(inputFile);
	FileOutputStream out = new FileOutputStream(outputFile);
	FileChannel inc = in.getChannel();
	FileChannel outc = out.getChannel();
	inc.transferTo(0, inc.size(), outc);
	inc.close();
	outc.close();
	in.close();
	out.close();
	boolean fileDeleteSuccess = inputFile.delete();
	if(!fileDeleteSuccess)
		System.out.println("File couldnot be deleted");
	else
		System.out.println("File deleted!!");
	} catch (FileNotFoundException e) {
	e.printStackTrace();
	} catch (IOException e) {
	e.printStackTrace();
	}
Former Member
0 Kudos

Thanks to all

Former Member
0 Kudos
Former Member
0 Kudos

hi

good

go through this link, i hope these ll help you to solve your problem,

http://help.sap.com/saphelp_nw04s/helpdata/en/dc/f1783fe3263042e10000000a114084/content.htm

thanks

mrutyun^