Hi,
Assuming both folders are defined in some way...
myPath1 = "~/Desktop/testCFolder"; // another way to define?
myPath2 = "~/Desktop/testPFolder"; // another way to define?
mFolderToCopy = Folder(myPath1);
mFolderToPaste = Folder(myPath2);if (!mFolderToCopy.exists || !mFolderToPaste.exists) { alert ("No copy/paste folder found"); }else{ mFiles = mFolderToCopy.getFiles("*"); // mask files action(mFiles, mFolderToPaste); }
function action (arr, destFolder) { progressWin = new Window ("palette", "" , [50, 150, 384, 240]), progressBar = progressWin.add ("progressbar", [12, 12, 312, 32], 0, arr.length -1), progressText = progressWin.add("statictext",[12, 52, 312, 72], "copying started"); progressWin.show(); for ( var k = 0; k < arr.length; k++) { progressBar.value = k + 1; arr[k].copy(destFolder.fullName + "/" + arr[k].name); progressText.text = "copying file: " + arr[k].name + " (" + Math.round( (k+1)/arr.length*100 ) + " of 100%)"; } progressWin.close(); }
In case of $.sleep() ==> you dont need to use it in fact.
It could be placed just for slow down the process and to let you see a progressBar window changes.
No other reasons.
rgds
Jarek