WatchDirectory Forum
http://www.watchdirectory.net/cgi-bin/yabb25/YaBB.pl
watchDirectory forums >> How to... >> Create a small dummy file with same name as source
http://www.watchdirectory.net/cgi-bin/yabb25/YaBB.pl?num=1438036558

Message started by presley on Jul 28th, 2015 at 12:35am

Title: Create a small dummy file with same name as source
Post by presley on Jul 28th, 2015 at 12:35am
What I would like to do is:
- monitor a directory for new files
- when a new file is detected, create a new file with the same name (does not need meaningful content, could have a single character in it.)
- put that file somewhere else
- delete original

I am dealing with large video files and I need to get the filename to place in a different directory.  I can do that today, but need to send the entire original ( like 400MB each) to the other location for the other process to get the filename.  I'd like to not have to transfer that large file when all I need to pass on is a small file with the same name.  Is that possible?

Thanks!

Jim P

Title: Re: Create a small dummy file with same name as source
Post by Gert on Jul 28th, 2015 at 10:17am
Hello Jim,

Use the run-a-batch file task and let it trigger the following script:
[code]
echo hello > "C:\SomeOtherDir\%WD_FILE_N%"
DEL "%WD_FILE%"
[/code]

%WD_FILE_N% is a variable that is replaced by the detected file name, %WD_FILE% with the full name including the path. See http://www.watchdirectory.net/wdhelp/plugins/wdopAutoRunBatEnv.html

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