How can I extract the folder path from file path in Python?

You were almost there with your use of the split function. You just needed to join the strings, like follows. >>> import os >>> ‘\\’.join(existGDBPath.split(‘\\’)[0:-1]) ‘T:\\Data\\DBDesign’ Although, I would recommend using the os.path.dirname function to do this, you just need to pass the string, and it’ll do the work for you. Since, you seem to … Read more

Copying files from one directory to another in Java

For now this should solve your problem File source = new File(“H:\\work-temp\\file”); File dest = new File(“H:\\work-temp\\file2”); try { FileUtils.copyDirectory(source, dest); } catch (IOException e) { e.printStackTrace(); } FileUtils class from apache commons-io library, available since version 1.2. Using third party tools instead of writing all utilities by ourself seems to be a better idea. … Read more