How to make Typewriter overwrite existing file - typewriter

Sometimes Typewriter generates output (1).ts files. How can I make it to overwrite the existing files?

Typewriter keeps track of which source file was used to generate the output file in order to automatically update the output file whenever the source file changes. Sometimes this tracking gets out of sync resulting in this behaviour.
To resolve the issue you'll need to delete both output.ts and output (1).ts and then render the .tst template or save the c# source file.

Related

How to rename a file while using "move" in URL in apache camel

I have an URL like
url = "file:D:/inputFolder?move=D:/outputFolder". we are making this url dynamically.
I want to rename the file while moving, So I made it something like this
url = "file:D:/inputFolder?move=D:/outputFolder&fileName=abc.txt". But I think move and fileName do not work together, it is not renaming.
Is there any alternative to do it? Please remember I want with "move" only.
I cannot use .setHeader(..) also.
Thanks,
Hy,
as far as I understand you, your trying to move the file in one single uri.
That is not really how camel works.
The idea of camel is to have a "consumer" and a "producer", where the consumer loads data (e.g. your file) and the producer puts the data somewhere (e.g. save the file into a folder)
That being said, here is what worked for me with a java route:
from("file:/home/chris/temp/camel/in")
.to("file:/home/chris/temp/camel/out/?fileName=test.txt");
The from part configures the folder where camel looks for new files. A few notes on that:
The file component checks the folder each 0.5 sec for new files. This can be changed with the delay parameter
The option noop configures, if the file is being moved or copied. By default it is set to false, which means it is moved
In the to part you configure, where the file is supposed to be moved. Here you can use the fileName parameter to rename the file.
Be careful with this though, because setting an option in the uri directly does make it "static".
What I mean by that is, that the only way of changing the parameter is by completely reconfiguring the route or by restarting it, where neither is something you would want to do normally.
Note 1:
Moving all files that are put into one folder into the same file always overrides the previous file by default.
You could, for example, use the fileExists parameter to always just append the content of the file: fileExists=Append (See camel file docu for details)
Note 2:
There is an option in the file component to not "move" the file, but copy, rename and delete it, which sometimes is necessary, when you want to move it onto a different drive and a simple copy does not work.
Also see the docu for the camel file component for details on that.
Note 3:
You can have multiple to() statements in the same route to have the file moved to multiple locations. For example:
from("file:/home/chris/temp/camel/in")
.to("file:/home/chris/temp/camel/out/?fileName=test.txt")
.to("smtp:....");
Hope I could help you and answer you question.
Greets
Chris
Two possible ways to achieve your goal.
Use both "consumer" and "producer"
Using this way, you are free to control where and how your destination can be set and has great freedom to control filename with the use of a processor/bean.
from("file:D:/inputFolder")
.to("file:D:/outputFolder?fileName=abc.txt")
Use "consumer" only
Using this way, you are treating your work as source data control. This can be use when your file is going to move within same drive. The drawback is the filename rename pattern is limited (refer to camel file language)
from("file:D:/inputFolder?move=${file:parent}/../outputFolder/abc.txt")

SSIS Loopeach file variable not maintained

I have done a couple projects using the LoopEach construct. This the first where I'm generating an output file inside a Data Flow in the loop.
I have a script that extracts the path and basename of the input file. I have looked at that is extracted (using FileInfo) and it is correct.
A few steps later, I am outputing to a flat file. I have both the input and output connection managers set to DelayValidation. The output keeps failing. Although I have the output set to a variable that includes the input file name (so it will continue to change, the output fails and shows the filename without the info from the variable.
The variable is set to a scope of the package, so it should be covered.
What am I missing???

cmd- Copying file content into specific lines of an existing file

I'm trying to make an batch file that will copy the contents of a .cfg file into another .cfg file. The problem I'm having is that I want the contents of the first file to be placed at specific lines of the destination file, for example, placing the contents between line 300 and 343 and overwriting the original content within those lines.
Any way of doing this?
If there isn't a way to detect specific lines maybe there is a way to detect a specific string, like an ID?
If you are allowed to use 3rd party tools in your environment you can use a regex CLI tool to find and then replace the lines / values you need. The tool can be called using batch scripts.
Example Tools from another question:
https://superuser.com/questions/339118/regex-replace-from-command-line

Running SAVE AS using a batch file

I have a batch file that creates text files in multiple folders.
What I need it to do as well, is after creating that text file, save a copy of it as a .scr file
If I were to do with this without a batch file, I would open the text file, click SAVE AS and save the file with a .scr extension. I cannot figure out how to add this feature to my batch file however.
The original text file cannot be erased, so I can't just change the extension. I would have to copy it, then change the extension, or imitate the SAVE AS feature.
Help?
I just used the ren *<> *<> command. It is extremely redundant because I end up making two text files that are identical and just changing one, but it gets the job done

Remove link to source code in doxygen?

I want my doxygen output to show only documentation, without showing any raw source code. I know that it is possible to hide the file browsing tab so that the user can only browse by namespace/class, and that this effectively hides source.
However, I have lots of functions in a top level namespace that are organized by file only, so I do want to maintain the capability to browse by filename. I just want to remove the link inside a file doc that says "Go to the source code of this file." Is there any way to remove this link?
Of course, I could write a script that analyzed all output HTML files and deletes any file ending in _source.html and also removes lines of this sort from remaining HTML:
<p>Go to the source code of this file.</p>
However I was hoping there would be a cleaner way to do this.
In your configuration file, set the following options:
SOURCE_BROWSER = NO
VERBATIM_HEADERS = NO
This still lists the namespaces in each file, but does not include the source code.

Resources