I need to run my Biztalk orchestration for every two hours and trigger will be a file that is present in location say "Folder2"
So I used folders "Folder1" and "Folder2". I copy files from "Folder1" to "Folder2" on timely basis(say for every two hours).I acheived this by writing some C# code and giving exe of this console application as Task in windows scheduler.
"Folder2" is configured as receive location in BizTalk application. So as soon as files are moved to "Folder2" they trigger BizTalk orchestration
Now I want to try with BizTalk scheduled task adapter.I can not use "XmlStringStreamProvider" as I want to strictly use files present in "Folder2".
Is there any possibility to run exe of C# appllication, in Task like in case windows scheduler?
Am completely new to it :-( Any suggestions would be of real help. Thanks in advance.
The answer to your specific question could be yes, but I wouldn't take that path. What you'd have to do is write a custom task that runs the .exe.
The Interface for the Scheduled Task Adapter is pretty simple so I strongly recommend you just implement the functionality directly rather than try to reuse the .exe.
All you have to do really is stream copy the contents of the file in Folder2 into the BizTalk Message submitted by the Task.
Related
I need to perform a file moving operation from one folder to another folder on remote desktop based on the month that files has been created and modified. I need to move the files(from folder A) of previous month to folder b. This service has to run(automatically) every month at the end so that the files will be moved to folder B
http://devproconnections.com/net-framework/how-build-folder-watcher-service-c
please guide me am new to C#.
Just move the file, eg
System.IO.File.Move("\\pcName\c$\temp\fileA.txt", "\\pcName\c$\newDir\fileB.txt");
REF: https://msdn.microsoft.com/en-us/library/system.io.file.move(v=vs.110).aspx
If I understand correctly
Move all files from folder A to folder B on the last day of each month
Then what I suggest is to use a batch file command to move the files, triggered by Windows Task Scheduler at monthly intervals.
Batch command (MyBatchFile.bat):
move c:\a\* c:\b
Windows Task Scheduler:
schtasks /create /tn "FayazbashaApp" /tr c:\MyBatchFile.bat /sc monthly /mo lastday /m *
Why don't you use a simple Scheduled Task using Robocopy or even your own Console App?
A Windows Service that will only be needed once a month seems like overkill to me.
Also, I would definitely not use .NET I/O Framework for this kind of thing, it's not as atomic as one would expect, you'd be better off with Robocopy.
I am looking for an idea on how I can launch a C# process based on something happening on a Windows server. My first challange is to determine when to start the first process. It needs to monitor a SFTP folder to see if a certain file type has been delivered. My initial thought was to have the task scheduler start a Perl script, have the script look to see if the file exists and then start the process. But once it has started the process, I don't want it to look for the file till the next day.
The second issue is that the first process moves files to another folder and then a third party application will start converting these files from PDFs to TEXT. The second process needs to start when this is done. I am not sure how to make this happen.
Thoughts??????
Write a windows service which uses a filewatcher to monitor for new files. https://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher(v=vs.110).aspx
That can then use File.Move to move the file out and into the alternate directory for further processing. https://msdn.microsoft.com/en-us/library/system.io.file.move(v=vs.110).aspx
I would use a Task for this and a task.continuewith to kick off the next 'stage' of your workflow, etc. Might also want to do a file COPY first, then a file delete (instead of a move, that way if something screws up during the copy you still have your original to work with).
I’m running a batch to do an update to my sql table. I’m using windows scheduler to run the batch file. Each day files come in at different time. Sometime they come in after my scheduled time therefore the batch file doesn’t run when there’s no file before the scheduled task in the folder. I want to create a c# program where it will loop through the folder until it finds the files and then move to the next step in the batch file. Basically my goal is to create a program that will look for those particular files and once they finds the correct files then it will start the update. I’m new to programming and need some direction. Can someone please help me with this? Thanks.
Read about FileSystemWatcher Class here
Looping will consume 100% of CPU
I need to create an Intranet website (page) which allows users to indicate a local network folder to copy to a production location. Currently this is done manually using xcopy in batch files.
What I am looking for is approaches on triggering the copy so it's done in the middle of the night and an approach to copy the files. I suppose I can run xcopy from my application, but is this a good way to do this? Should I use System.IO name space objects to copy the files? Is there a better way all together?
The application will be written in C# and ASP.NET. We currently use .NET 2.0/3.0, but I have no issues using .NET 3.5 if it contains better libraries for the solution.
Basically a user will indicate which network folder they need copied along with some other business information. The folder indicated and all sub-folders need to be copied to target location (not set by user).
If there is already an application out there which does this, I am not opposed to that either. I have no need to write stuff that already exists.
For the first problem (copying at midnight), I suggest setting up a scheduled task that runs the already existing batch file (or any program, for that matter)
For the scheduling part you could use Quartz.NET
It won't be difficult to write an xcopy operation in C# using System.IO. In fact, this would give you the greatest degree of flexibility.
I think you should consider using Windows Powershell to do your copying (or another scripting language if you prefer), driven by Windows Scheduled Tasks. Though you could write an application to do this, I think it would be much more maintainable to have a script that others could edit.
The simplest solution would be to wrap your xcopy commands in a command file and schedule it to run whenever you want as a Scheduled Task on your web server.
If you want to get fancy, you can write up a web interface to the task scheduler - I'm pretty sure I've seen open source examples of that type of application too.
you've tagged this ASP but if you aren't fussy I'd recommend a combination of Windows builtin Scheduled Tasks and rsync. If it really has to be automated from an intranet page (and you're in IE) then some form of ActiveX or downloadable script/application would be needed to configure the schedule.
I currently have a manual process where we upload a text file to a business partner, they have an automated process which reads in the file, processes it and then generates a 'results' log file any where from 3-10minutes (typically) after the initial upload. I need to automate this process via a .NET application.
I already have the upload completed, what I do not have is the download of the result. Since I dont know exactly when the file will be ready to download I figure that I must need to poll the remote site every so often, get a listing of the files in the results directory and see if one matches what I am expecting.
I have done some reading and found some references to AsyncCallBack but I'm not really sure how to proceed with it. the solution has to be something I can manage without any third-party libraries outside of .net since I have a budget of 0 for this little project.
Any help would be greatly appreciated!
Just have a thread (or your main thread) sleep for x milliseconds and attempt to do the download when it's not sleeping. No need to buy a 3rd party FTP library, FTP is built into .NET (FtpWebRequest and FtpWebResponse). They aren't very good (very bare bones) but will probably do for what you want.