Skip to main content
Known Participant
August 3, 2014
Question

Move files from one folder to another javascript?

  • August 3, 2014
  • 2 replies
  • 37493 views

I am running a 3-action droplet automatically using windows task scheduler.  Here are the 3 steps:

1.    Batch file to move files from hot folder to processing folder

2.    Run IPP (dr brown's image processor pro) using preloaded settings to make several sizes copies of the files.

3.    Bat file to move the files from processing folder to archive folder.

The problem I am observing is that Step 1 works and IPP begins to run.  It only processes the first few images, and then moves on to the 3rd step where the bat file is ran to move all files from processing folder to archive folder.   The trouble is, only a few images were processes (about 10 or so), yet all of the images get moved to the archive without being processed.  Is there a way to make sure that step 2 (IPP) doesn’t begin until all files have successfully been moved from the hot folder to the processing folder?  IPP starts right away and files are still being transferred to the processing folder.

Does anyone have a script that will move files from one folder to another? 

This topic has been closed for replies.

2 replies

JJMack
Adobe Expert
August 5, 2014

It sounds like that IPP and the move bat files are running concurrently that the bat starts some time after IPP starts and that it copies the files from the processing folder to the archive folder then delete the files in the processing folder before IPP has processed all the image files. Are you using widows scheduler to run a bat command file? I have not use a droplet to start Photoshop in years and don't understand what you mean by a three action droplet.  are you creating an droplet the use a single action that plays other actions?

The Process should be done is a single action that use two scripts steps so they are done in sequence not concurrently.

JJMack
Known Participant
August 5, 2014

I have a single action, that has three steps.  I've made this action into a droplet.exe

1.  bat file to move files into processing folder

2.  IPP

3.  bat file to move file from processing to archive folder.

The problem is that Step 2 begins shortly after step 1, and IPP only sees about 10 photos at the time IPP starts.  IPP processes those 10 completely, and then the 3rd batch file starts.  Step 3 never happens before IPP ends. 

Here's what I'm going to try.

Step 1.  bat file to move files into processing folder

Step 2.  bat file to kill all open command windows.  not sure if the action will "wait" until the first step is finished or not..hmmm

Step 3.  IPP

Step 4.  bat file to move file from processing to archive folder.

Known Participant
August 7, 2014

Hi JJ,

You posted over 10,000 lines of source code in the other thread, so it was nearly impossible to navigate .  This solution is now working perfectly.  The process starts with a windows task schedule calling a .bat file to do the following:

1.  Move files from hot to processing folder. 

2.  Run droplet.exe that has two steps in the action

     Step 1.  Run IPP

     Step 2.  JSX bat to move files from processing to archive.

All is well.  Thanks so much for the help everyone.


Is there a way to add a step to my action to safely "close photoshop" after IPP finishes?  This will free up ram on my processing machine, when the script is not in use.

DBarranca
Brainiac
August 3, 2014

Hi,

this might help:

// Use at your own risk

// test it before!

var sourceFolder = new Folder("~/Desktop/temp/source");

var destFolder = new Folder("~/Desktop/temp/destination");

var fileList = sourceFolder.getFiles();

for (var i = 0; i < fileList.length; i++) {

    if (fileList.copy(decodeURI(destFolder) + "/" + fileList.displayName)) {

        fileList.remove();

    } 

}

Regards,

Davide Barranca

---

www.davidebarranca.com

www.cs-extensions.com

Inspiring
August 3, 2014

This will create NEW files though...

Known Participant
August 3, 2014

Is there a way to do this without creating new files?