Hi.
I’m trying to write a Katalon script which can move directories on my local computer from one parent directory to another. In particular, I wish to use this to move the auto-generated Reports directory upon completion of a suite run. I have tried multiple things but nothing works.
As a test, I have two folders in my Downloads directory.
C:\Users\jdoe\Downloads\folder1
C:\Users\jdoe\Downloads\folder2
I wish to move folder1 into folder2.
I wrote a command line script in a file moveFolder.cmd.
move c:\users\jdoe\downloads\folder1 c:\users\jdoe\downloads\folder2
When I run it from my Windows Command Line, it works correctly and folder1 disappears and appears in folder2.
So, I try to write a Java script in Katalon.
Runtime runtime = Runtime.getRuntime()
ProcessBuilder pb = new ProcessBuilder("C:\\Users\\jdoe\\Downloads\\moveFolder.cmd")
Process p = pb.start()
This runs through without any errors, but with no effect on the folders.
So I try instead to use the FileUtils library with this Katalon script.
File dir1 = new File("C:\\Users\\jdoe\\Downloads\\folder1");
File dir2 = new File("C:\\Users\\jdoe\\Downloads\\folder2");
FileUtils.copyDirectory(dir1, dir2, DirectoryFileFilter.DIRECTORY);
It passes without an error but no change to the folders.
So I try the Files library with this Katalon script.
File dir1 = new File("C:\\Users\\jdoe\\Downloads\\folder1");
File dir2 = new File("C:\\Users\\jdoe\\Downloads\\folder2");
Files.move(dir1, dir2)
But I get an “Access is denied” error this time.
java.io.FileNotFoundException: C:\Users\in038\Downloads\folder1 (Access is denied)
My theory is that this is all some “user access rights” issue.
Windows 10 for some reason sets all my computer folders to “Read Only”, which I cannot remove. So, I gave all folders “Full Control” rights to users but this affected nothing.
I would appreciate any advice. If running my script from command line works fine, then should I conclude that Katalon somehow blocks certain admin rights when accessing folders?
Ilya