Hello. I new here. You have nice forum.
I need to create bath file for copy file, that will be created by my program, from original folder to backup folder.
I can't to know the name of the file and I need to execute this BATCH in time of creation (for this i have parameter in my program, with execute any executable files).
My development gay give me this :
copy %1 C:\Backup_folder
but it"s not work.
What they forget to say to me?
Please help me
Oleg
How create BATH file for file copy
Moderator: DosItHelp
Re: How create BATH file for file copy
It's hard to understand what you're looking for.
OK, what I understood so far:
- a program creates a file
- you need to copy the file into "C:\Backup_folder"
Question:
Do you know the name of the file?
Regards
aGerman
OK, what I understood so far:
- a program creates a file
- you need to copy the file into "C:\Backup_folder"
Question:
Do you know the name of the file?
- YES
Can you call a batch file with that name as parameter?Code: Select all
copy %1 C:\Backup_folder\
- NO
How could you find out the name?
Regards
aGerman
Re: How create BATH file for file copy
Hi.
You understand correctly.
System generate file, but i can not know the name of the file. The name depend on other parameters.
Yes, I can call the bath file, but I have possibility to put only the path to batch file. I don't know how I can declare the parameter.
Or you mean to call the batch file which have a name as a parameter?
You understand correctly.
System generate file, but i can not know the name of the file. The name depend on other parameters.
Yes, I can call the bath file, but I have possibility to put only the path to batch file. I don't know how I can declare the parameter.
Or you mean to call the batch file which have a name as a parameter?
Re: How create BATH file for file copy
Hmm. If you don't know the file name you have to define the rules how to find the right file. For Example:
-Is it always the same folder where the file is generated?
-Has it always the same file extension? (.txt or .csv or .xml or ...)
-Is there only one file with that extension in the folder?
What else is suitable to find the file? I need your collaboration because I don't have all the background information.
Regards
aGerman
-Is it always the same folder where the file is generated?
-Has it always the same file extension? (.txt or .csv or .xml or ...)
-Is there only one file with that extension in the folder?
What else is suitable to find the file? I need your collaboration because I don't have all the background information.
Regards
aGerman
Re: How create BATH file for file copy
First of all, thank you about your responds.
Second, I know the folder and sometimes I have something constant in the name or in the extension. Also, this folder is always empty, because other program take this file(s), but i can't based on this because it's always delay - I mean, my program generate file every 5 minutes, and other program take files every 2 minutes.
So basic constant rule : folder name, and sometimes extension.
Also, the OS in the machine is Win Server 2008 32 bit.
Based on this, what your suggestions?
Best Regards
Oleg
Second, I know the folder and sometimes I have something constant in the name or in the extension. Also, this folder is always empty, because other program take this file(s), but i can't based on this because it's always delay - I mean, my program generate file every 5 minutes, and other program take files every 2 minutes.
So basic constant rule : folder name, and sometimes extension.
Also, the OS in the machine is Win Server 2008 32 bit.
Based on this, what your suggestions?
Best Regards
Oleg
Re: How create BATH file for file copy
oleg2206 wrote:I mean, my program generate file every 5 minutes, and other program take files every 2 minutes.
You should think about it. In the worst case your program generates the file and at the same time the other program removes it. How should the batch copy a nonexisting file? I'm afraid it's impossible to make sure that it would always work.
To copy each existing file in a folder you could use the asterisk
Code: Select all
copy "C:\where\the\files\are\generated\*" "C:\Backup_folder\"
Regards
aGerman