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
Copy with backup (Read 2010 times)
andersv
YaBB Newbies
*
Offline



Posts: 1
Copy with backup
Mar 12th, 2010 at 10:34am
 
Hi,

Im trying to configure a kind of advanced copy script;  my issue is this:

Input folder:   \changedjpg\<file.jpg>

Output folder: \images\<year>\<month>\<day>\<file.jpg>

Where year, month, day is always todays date, so if i put an image named file.jpg in \changedjpg today i want it to be copied to \images\10\03\12\file.jpg.

So far so good, i managed to get it working with dynamic naming, but since this is a production environment i want to make a backup before overwriting the image, i cant find a way to make it combined with dynamic naming.

it would be nice to copy the file only if destination exists, but thats not crucial.

Im also looking for a more advanced copy function, that searches a couple of subdirectories and copies the file to the directory where the file already exists, for example:

\images\sport\10\03\12\sun.jpg
\images\news\10\03\10\dance.jpg
\images\news\10\03\12\dance.jpg
\images\news\10\03\12\flower.jpg

if i put a image in \changedjpg named dance.jpg the script would replace the file \images\news\10\03\12\dance.jpg, but not \images\news\10\03\10\dance.jpg

Could this be done with watchDirectory?


Back to top
 
 
IP Logged
 
Gert
YaBB Administrator
*****
Offline



Posts: 2225
The Netherlands
Re: Copy with backup
Reply #1 - Mar 12th, 2010 at 10:42am
 
If you want to copy a file to multiple destinations (your "backup"), you have 2 options you can use with WD.

1. Use "Sort Files" instead of "Copy"
See http://www.watchdirectory.net/wdhelp/plugins/wdopAutoSort.html
If you set "Final Rule"  to No, one detected file can trigger multiple copy's.

2. Use the "Run SubTasks" plugin
See http://www.watchdirectory.net/wdhelp/plugins/wdopMultiPlugin.html
You can import your current "copy" task so it will become a sub-task.
Then create another SubTask (maybe by importing the "copy" again) for the backup location


If you use
D:\images\news\{year}\{month}\{day}\{filename}
as the dynamic name, your dance.jpg will always be copied to the correct "news" sub-directory, based on today's date.

Gert
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
 
Page Index Toggle Pages: 1