Is it possible to add one line to a set of files in Ant? basically i have a folder which has sub-folders, each subfolder contains different types of files, such as xml files, cmd files, etc. Now I need to add one line to all cmd files under that folder. have searched around for a while, but couldn't find a clue.
Is it possible in Ant?
This should be possible using the copy task with a filterchain. This filterchain would contain a concatfilter with an append attribute pointing to a file containing the line to add.
See http://ant.apache.org/manual/Types/filterchain.html#concatfilter and http://ant.apache.org/manual/Tasks/copy.html for details.
Related
I am creating a program that opens files in a folder that contains "RPA" in their name. so, how can I do that?
You will use Loop on File in Folder command, and if condition inside the loop to check if the file name includes RPA.
Loop on Files on Folder
If condition $Filename$ includes RPA
Do Something here eg. open program/file command
End If
End Loop
#Shivam,
To get more clarity on your problem statement, you mentioned once that the files are already in PDF.
Are you trying to copy content from PDF to Word? In that case, you could use PDF Integration commands, provided the PDFs are not hand-written or scans. If that is the case, the text extraction might become more unreliable.
A safe bet with Automation Anywhere is to just extract all the text, open a new Word document and paste the content and save file.
Saving all files as word might a little counter-intuitive. You can just use the If statement within your for loop to only process files with "RPA" in their name.
Hope this help. Let us know you go :-)
its pretty simple use includes in your if statement
workbench snapshot
I'm trying to understand the logic behind TFS 2013 Copy Files action's Content filter syntax. I have a simple solution with a couple of projects and some test projects, which unfortunately have huge test files. I don't want the test projects or the files in the drop folder. Test projects are named like Project.Test, Project2.Test etc.
I tried to filter them like this:
**\bin\$(BuildPlatform)\$(BuildConfiguration)\**;-:**\*.Test\**
But this doesn't copy anything.
Test files are located in directories called TestFiles.
This also filters out everything:
**\bin\$(BuildPlatform)\$(BuildConfiguration)\**;-:**\TestFiles\**
If the first part matches the correct files in bin directory, how can the second part them filter them out? I don't see how that can match the same files.
Solution to my problem was to use a different syntax to exclude certain directories (*.Test here):
**\!(*.Test)\bin\$(BuildPlatform)\$(BuildConfiguration)\**
In my app I had a folder of images from which I was getting the names to use as keys to a Dictionary. I have now moved all images to an asset catalog and created groups for the relevant folders. The code using FileManager is not working anymore as it can not find any folders (due to the assets being compiled into a .car file).
How should I approach this?
So (following matt's suggestion) here is what I did:
I created a RunScript build phase to run before compiling
and used a script to create a txt file with the names of the files that I can then use during runtime
#!/bin/sh
>./your_app_folder/fileNames.txt
for FILE in ./your_app_folder/Images.xcassets/actions/*; do
echo $FILE >> ./your_app_folder/fileNames.txt
done
You have two choices:
Don't Do That. Go right on using a folder of images.
Supply the keys in some other way. If you don't want to hard-code them into the code itself, you could make a text file. But of course you will have to keep that text file updated as you add / remove images.
You'll notice that I didn't say you could magically introspect the asset catalog. That's because you can't.
I am working on product testing automation. I am using Jenkins to create a job that will first browse some file in a directory. But I got a problem with Conditional Step in File Exist condition. It is not working when I search *.job file, it only works with specific file name I put. Sorry I don't have enough reputation to post picture :)
Anyone can help me solve this issue. Thank so much for reading
I don't think File Exists supports more than one file, you could try the "File match condition". Definitions below:
File exists Run if the file exists.
The file is expanded using the Token Macro Plugin. If the file is
relative, then it is relative to the Base directory. If the file is
absolute, then it will be tested on the Node that contains the Base
directory (the master for $JENKINS_HOME and Artifacts dir).
Files match Run if one or more files match the selectors.
Separate multiple includes or excludes patterns with a comma. e.g.
Includes "target/site/**/*.html,target/site/images/" Excludes
"**/*.gif" If no includes pattern is configured, then the pattern
"**" will be used, which matches all files in the directory and all
sub directories. The includes and excludes are Ant Patterns.
I am using Editable Email plugin in Jenkins to attach a file with the email. The problem is that the plugin is unable to find the file to attach.
My file structure is like this -
ReportDirectory
workspace
ReportDirectory contains the report which I want to attach. I believe that the base directory for the plugin is the workspace. So I am giving the attachment location as
../ReportDirectory/DemoReport.html.
I have also tried
ReportDirectory/DemoReport.html
and many more options.
Am I doing something wrong?
I figured it out.
The Editable Email plugin uses the Ant File Syntax for locating the attachment. When I took at the documentation for Ant File Syntax ( http://ant.apache.org/manual/dirtasks.html ), it says that
In general, patterns are considered relative paths, relative to a task dependent base directory (the dir attribute in the case of ). Only files found below that base directory are considered. So while a pattern like ../foo.java is possible, it will not match anything when applied since the base directory's parent is never scanned for files.
Since the base directory in this case is the "workspace" and my directory "ReportDirectory" is not located in it so the Ant is not able to access it.
Two solutions exist:
Move the "Report Directory" somewhere in "workspace". I did not prefer this because I did not want to mess up the workspace.
Once the report has been created in "ReportDirectory", use your Ant\MSBuild script to copy it temporarily in the "workspace" and then the Email plugin shall be able to access it by something like **/Report.html or something.
#Amey - thanks for your efforts though :)
Another solution is create a symbolic link from $JENKINS_HOME/jobs/workspace/$workspace_name to the path with your $workspace_name. This way worked for me.
ReportDirectory/DemoReport.html
is the correct way to do it.
Please keep in mind that the path to the file and the file name is case sensitive so I assume your entering the correct name.
One more thing is to check is that the report is actually created and is located at the path mentioned by you.
Another thing you could try
ReportDirectory/*
Jenkins will use the directory available in its workspace.
You can send multiple attachments as below.
reportFolder/html/index.html, screenShotsFolder/screenShots/*.jpg
Simple answer:
Copy your file into the workspace(into your job directory), then under Attachment, just give the file name without any quotation or anything. This will automatically tell Jenkins to pick up your file. That's it!
Pls don't confuse yourself after seeing all the configurations.