WatchDirectory Forum
http://www.watchdirectory.net/cgi-bin/yabb25/YaBB.pl
watchDirectory forums >> How to... >> Delete an original
http://www.watchdirectory.net/cgi-bin/yabb25/YaBB.pl?num=1336563442

Message started by Thommen on May 9th, 2012 at 1:37pm

Title: Delete an original
Post by Thommen on May 9th, 2012 at 1:37pm
Hello,
First post on this fantastic software's forum  :)

I use a task to copy files into the Dropbox folder.
I noticed a Dropbox issue : when a file change but keep the same name, DB keep (in cache ?) the old file...
So I use the WD "Rename the existing filewith date/time" option.
But of course the old file (unrenammed) stay in the DB folder.
I want to delete it to not charge the DB and to not confuse the DB users with several versions of a +/- same file (minor changes force to create a new file).
How to do that ? Must I create a new task or is there a tip I can use with the WD copy option ?

To well understand, here is how the task runs :
I create a folder named automaticly by a 3rd party software, there is a subfolder int it nammed "Documents" --> this folder is watched by WD.
Eg : 12345ABC/Documents/file.txt
All files placed in this folder are copied  in a folder created by WD into a the DB folder like this : 12345ABC/file.txt
When the original file.txt is modified (in the "Dociments" folder), we have file.20120509123026.txt + file.txt

I hope you can help me, thank you in advance !

Thommen

Title: Re: Delete an original
Post by Gert on May 9th, 2012 at 3:47pm
Hi,

If I understand you correctly, you want this to happen:

when file.txt is detected, try to copy it to "target directory".
if the file already exists in "target directory" copy it to file.<timestamp>.txt and remove all "older versions" (file.*.txt).

Is that correct? I think that can not be done by the "Copy Files" task, but will probably work with a little batch script using the "Run a bat file" task.

I will be happy to write the bat script for you (in the next few days), let me know if I understand the problem correctly.
Gert

Title: Re: Delete an original
Post by Thommen on May 9th, 2012 at 11:33pm
Hi again and again Gert  :D

That is it ! I write in blue some precision in your quote :

when file.txt (any kind of file and extension exept the system files (.ini, thumb.db,...) is detected in a specific subdir (that have a fixed name) of a directory (totaly free name (letters, numbers...)), try to copy it to "target directory" that have the same name that the origin "totaly free name" directory.
if the file already exists in "target directory" copy it to file.<timestamp>.txt and remove all "older versions" (file.*.txt).

I hope you'll understand ;)
This topic is in relation with the other (Kind of mirroring but not a one) I've posted today.

Thank you again for this perfect support !

Thommen

Title: Re: Delete an original
Post by Gert on May 11th, 2012 at 7:05am
Thommen,

I hope to get to this later today (this evening) or tomorrow. Can you send me an email (see below for my address) so we can "talk" about this outside the forum?
Oh, can you send me a backup of your current "Copy Files" task so I can have a look? See http://blog-en.gdpsoftware.com/2010/06/send-task-backup-to-support.html

Gert

Title: Re: Delete an original
Post by Thommen on May 28th, 2012 at 2:51pm
Hello Gert,

After several days of testing, your solution works perfectly!
Thank you so much!

Thommen

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