Tuesday 15 June 2010

Process a file after a file is finished being written Windows Command Line .bat -


I asked this question for Java and Linux (did not answer too much) but for the Windows Command Line batch operation No. I want to say that I want to use the Windows Command Line. I am pulling my hair trying to take it out.

A multimedia file is being converted into a folder x. Once the file conversion is complete, it has been ftp'd again using winSCP. WinSCP command line syntax I possibly can understand

One way I have underlined, one for loop will be used like this:

File size is written to a variable < / P>

Pause to use FTP Null Ping Tricks for 5 seconds (as mentioned in Answer 1)

Then check to see if the size of the file If it is similar to the previous variable .. stop loop check and win SCP (I window I'm using winSCP instead of command line FTP because Windows FTP does not run idle).

The problem is that I did not find any way to write a file size in any variable. Apart from this, I have to make sure that the file has started once for the file that it stops watching that file and waits for a new multimedia file to enter the folder.

As I do this, I am waiting for the moment till all the files are finished uploading via FTP, which adds more time to the process, I actually have this process of Bat To do this via automation, but apart from this it will save me time.

Thanks in advance for any help.

EDIT: I found this link to get the file size of a file: it does not answer my question, but surely an important part of the equation

Getting file size in a variable is simple - for the in %% F ( FilePath) "Size = %% ~ zF" .

But I believe I can give you a better solution.

Unix, unlike Unix, most Windows processes get a special lock on the file when they are writing it, assuming that your conversion process constantly locks the output file during processing, then you can lock the file (Still processing) or if it is not locked, you can use the following (end processing):

  ((call)> Output file . Lesson 2) Neul & amp; (The resonance file is ready to unlock and transfer) || || (Echo file is still being created)   

(call) Syntax is just a very fast command which does nothing - effectively a null Session This command is not guaranteed to be of any output, so when you add the results of the command to your file, it is guaranteed that it does not change anything.

If the file is already locked because it is still being processed by your conversion program, redirection will again fail due to redirection failure 2 & gt; Null hides any error messages, and & amp; Amp; and || command in operator command) based on the success or failure of the pre-order. To not return the location, move (call) away and the command returns an error (error code = 1) that will break the lock detection algorithm. It is interesting that the form without any space returns the error without generating the error message. I believe that both of those commands are the most effective way to clear or set batch error codes.

No comments:

Post a Comment