Answer the question
In order to leave comments, you need to log in
How and how to copy files when they appear in a folder?
There is a folder in which files from one program sometimes fall, after a while they are taken by another program and the folder becomes empty again, etc.
It is necessary in some way to copy / archive the files that appear and put them somewhere.
What and how to do it?
Answer the question
In order to leave comments, you need to log in
to my shame recently discovered
robocopy for myself
robocopy /?
/MON:n :: Наблюдать за источником; перезапустить после n изменений.
/MOT:m :: Наблюдать за источником; перезапустить через m минут, если произошли изменения.
/MOV :: Перемещать файлы (удаление из источника после копирования).
/MOVE :: Перемещать файлы и папки (удаление из источника после копирования).
/LOG:файл :: Записывать состояние в файл журнала (перезаписывать существующий журнал).
/LOG+:файл :: Записывать состояние в файл журнала (добавлять к существующему журналу).
1. According to the mind - to teach the receiving program after processing the files not to delete them, but to transfer them to the directory of processed files.
2. call the second program, for example, from a batch file, in which, before starting the program, 1. the presence of files in the directory is checked, 2. files are copied to the archive directory, 3. the program is launched.
3.If the call of the second softina cannot be stuffed into a batch file (for example, it must constantly work), then it remains only in the scheduler to run a batch file every minute / second, copying files to the archive directory. This is the worst option - it is possible to lose files when accessing the file at the same time.
In general, you need to know more about the capabilities of the programs. Then you can give a more specific answer.
And by the way, the question remains - how are programs 1 and 2 synchronized with each other? There may be a case when 1 program has not yet finished writing the file, and 2 has already started processing it. If you haven't had one yet, you definitely will!
The first program is run as a user with write access to the folder.
The second program is read-only. The result - the files will not be deleted by the second program.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question