WatchDirectory home page
WatchDirectory Startseite (Deutsche Version)
Site WatchDirectory (Français)
  Welcome, Guest. Please Login or Register
YaBB - Yet another Bulletin Board
   
  HomeHelpSearchLoginRegister  
 
Page Index Toggle Pages: 1
If a file is present move the whole folder to FTP (Read 383 times)
BGEtest
YaBB Newbies
*
Offline



Posts: 4
If a file is present move the whole folder to FTP
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?
Back to top
 
 
IP Logged
 
Gert
YaBB Administrator
*****
Offline



Posts: 2224
The Netherlands
Re: If a file is present move the whole folder to FTP
Reply #1 - 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%"
 


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.

Back to top
 

Gert Rijs - gert (at) gdpsoftware (dot) com
Blog: http://blog-en.gdpsoftware.com/
End Alzheimer's: http://www.alz.org&&...
WWW WWW GdPSoftware  
IP Logged
 
BGEtest
YaBB Newbies
*
Offline



Posts: 4
Re: If a file is present move the whole folder to FTP
Reply #2 - 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
Back to top
 
 
IP Logged
 
Page Index Toggle Pages: 1