WatchDirectory Forum
http://www.watchdirectory.net/cgi-bin/yabb25/YaBB.pl
watchDirectory forums >> How to... >> If a file is present move the whole folder to FTP
http://www.watchdirectory.net/cgi-bin/yabb25/YaBB.pl?num=1486662690

Message started by BGEtest on Feb 9th, 2017 at 6:51pm

Title: If a file is present move the whole folder to FTP
Post by BGEtest on Feb 9th, 2017 at 6:51pm
in a particular folder I have subfolder and files created with random names for example:

ncabr1 folder will contain: image010.tif , image020.tif , odi.txt

nacbr2 folder will contain: image040.tif, image50.tif

when these files are successfully created, a file called odi.txt is created.

So I will have to move only the folders that contain the odi.txt file

ncabr1 folder will contain: image010.tif , image020.tif , odi.txt
nacbr2 folder will contain: image040.tif, image50.tif

What i have to do is move only the folders in which the odi.txt file is created in.

The difficult part: file names are random

what is the best way to accomplish this task with watchdirectoy?

Title: Re: If a file is present move the whole folder to FTP
Post by Gert on Feb 10th, 2017 at 5:46am
I think you emailed me earlier? Did you receive my reply?

Anyway, the way I would set this up, you need 2 tasks.

Task-1, using the "Run a batch file" plugin
This task monitors your directory and only triggers for "odi.txt" files, use "Filter Events" ( http://www.watchdirectory.net/wdhelp/help/filter_events.html ) so it only triggers for those. The script that is started by this task moves all files to another directory (monitored by Task-2). Here is an untested example:
[code]
REM Script started by Task-1 when odi.txt is found
SET TARGET=C:\Task-2
REM create the "same" directory below TARGET
MD "%TARGET%\%WD_RELDIR%"
REM move all files found in the detected file's directory to this new target
MOVE "%WD_FILE_D%\*.*" "%TARGET%\%WD_RELDIR%"
[/code]
The %WD_...% variables used are explained here: http://www.watchdirectory.net/wdhelp/plugins/wdopAutoRunBatEnv.html

Task-2, using the "Upload files" plugin
This should be obvious. It monitors the target directory of task-1 (C:\Task-2 in the example above) and whenever it detects any file it uploads.


Title: Re: If a file is present move the whole folder to FTP
Post by BGEtest on Feb 13th, 2017 at 5:32pm
Get would you be able to send me your email I have a few more questions - nkawa@bgeltd.com

WatchDirectory Forum » Powered by YaBB 2.5.2!
YaBB Forum Software © 2000-2017. All Rights Reserved.