R
R
Rad1us2016-05-04 10:53:35
System administration
Rad1us, 2016-05-04 10:53:35

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

4 answer(s)
E
Eugene, 2016-05-04
@rad1us

to my shame recently discovered
robocopy for myself

robocopy /?
/MON:n :: Наблюдать за источником; перезапустить после n изменений.
/MOT:m :: Наблюдать за источником; перезапустить через m минут, если произошли изменения.
/MOV :: Перемещать файлы (удаление из источника после копирования).
/MOVE :: Перемещать файлы и папки (удаление из источника после копирования).
/LOG:файл :: Записывать состояние в файл журнала (перезаписывать существующий журнал).
/LOG+:файл :: Записывать состояние в файл журнала (добавлять к существующему журналу).

help out of 10. in 7-ka (and 2008 R2 server) the cited functionality is.
You can put it in the scheduler at the start of the system.
What to synchronize and what to skip is perfectly configurable.
Back in April, I would advise you to rewrite the Powershell script to suit your needs)

R
res2001, 2016-05-04
@res2001

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!

H
Heyzi, 2016-05-04
@Heyzi

bat'nick + scheduler

K
Konstantin Tsvetkov, 2016-05-04
@tsklab

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 question

Ask a Question

731 491 924 answers to any question