File Path in Variable -> File identifier in File Content for Power Automate Flow - power-automate

So I have this flow step and I want to replace hardcoded value of file identifier
with variable.
(Point where I call variable)
(How variable looks like)
Hardcoded path works, I tried it.
I want to set hardcoded path into variable and use it in steps like variable.

There are two operations for retrieving file contents, you need to use the right one when you want to use.
I created a basic variable with a file name ...
... and then tested with both types of Get file content operations in the SharePoint group.
You need to use the Get file content using path operation.

Related

NiFi use relative path for get and put file processor

New to NiFi, struggling with some basics and would be grateful for any assistance...
I need to get files from a remote server and store them on a NiFi server. Using GetSFTP and PutFile this works ok. But I wish to keep the relative paths.
ie. on remote server /data/hosts/host01/.... would be copied into /imports/host01/... on NiFi
I have this working by using /imports/$path:substring(11)} as the Directory value in PutFile. I have tried using a parameter and a variable to store the Remote Path value and tried using the :length(var1) function of the Parameter and/or Variable within the the above substring function but nothing seems to work other than hard coding the substring length.
Is their an easier way to keep relative paths with get and put processors??
GetFile and PutFile require absolute paths for the directories. If you know the relationship between the root directory and the destinations, you can construct the full path using Expression Language.

Check directory contents and assign then to variables

Using Bash, how can I check the contents (archives, files, etc) of a certain directory, and assign them (their names) to different variables? Of course, first I need to verify if such directory exists, then check and display its contents, and finally assign them to variables. Thanks in advance.

How to upload unique file. Jmeter distributed testing

I have a scenario where I have to upload a unique named text file.I have used counter in the thread level and using the reference name as file name.say If I want to upload the File_1.txt, I have used something like this file_${counter_refname}.This is working like a charm in single machine but, Now the problem is when I run in the distributed mode slave_1 is uploading the File_1.txt and Slave 2 machine is also uploading the same file File_1.txt. The Target server will not allow to upload file with same name. How to resolve this problem??
Use a CSVData Set that will contain file names.
Create 1 file per distributed node referenced by it and ensure all these files never contain the same file name.
To do it, first create 1 file with unique names then split it in as many files as you have nodes.
Another option is to just generate a unique file name if sequence number is not important by using __UUID function:
http://jmeter.apache.org/usermanual/functions.html#__UUID
There is a couple of functions which can help to identify slave machine and parametrize file name.
__machineName() - returns hostname of machine running JMeter instance
__machineIP() - the same for IP address
Also you can look into __Random() or __RandomString() functions to generate unique files with random names on the fly i.e. with Beanshell PreProcessor as follows:
import org.apache.commons.io.FileUtils;
String filename = "file_${__Random(10000,99999,)}.txt";
FileUtils.writeStringToFile(new File(filename), "a quick brown fox", "UTF-8");
vars.put("filename", filename);
Refer to generated file name as ${filename} where required.

How to get the name of the exe in the Innosetup script from the full path of the exe is given?

For example if the full file path of the exe is provided as C:\Projects\Executable\Serial Data Streaming Recorder.exe, I need to extract the name of the exe. That is Serial Data Streaming Recorder and I want to dynamically assign this value to a variable from the full file path of exe.
Manually done like in below example:
#define ExePath "C:\Projects\Executable\Serial Data Streaming Recorder.exe"
#define AppName "Serial Data Streaming Recorder"
I want to dynamically assign the value Serial Data Streaming Recorder to the variable AppName from the full file path of exe.
I'm using this name in many places in the inno script for many files, So i don't want to do it manually by assigning this value to a variable.
To do this at runtime in [Code] You can get the file name and extension using the ExtractFileName(). I think you can then remove the extension by passing blank to the ChangeFileExt() function but if not, you can find and remove it using standard string operations like Pos() and Delete().
If you need to do this at compile time, you need to use ISPP, most of the functions have the same name and signature so use ExtractFileName() to get the file name itself, RPos() to get the period and Delete() to remove it.
Hmm... I usually solve this simply by never using any absolute paths in my install scripts. You can also just define ExePath like this:
#define BasicName "Serial Data Streaming Recorder"
#define ExePath "C:\Projects\Executable\" + BasicName + ".exe"
and then use {#BasicName} whenever you need just the name.
There are also several preprocessor script functions (not pascalscript) that can do string manipulations to do more advanced stuff.

WinAPI function which replaces file but preserves file information

I remember there was a WinAPI function which copied the "date modified" property of the previous file which was replaced with it or something like that? Perhaps anyone can tell me about it?
The problem occured when you used that function very frequently.
This is ReplaceFile (Windows 2000 and up):
The ReplaceFile function combines
several steps within a single
function. An application can call
ReplaceFile instead of calling
separate functions to save the data to
a new file, rename the original file
using a temporary name, rename the new
file to have the same name as the
original file, and delete the original
file. Another advantage is that
ReplaceFile not only copies the new
file data, but also preserves the
following attributes of the original
file:
Creation time
Short file name
Object identifier
DACLs
Encryption
Compression
Named streams not already
in the replacement file
Not too clear exactly what you want, but it seems your after SetFileTime to edit and GetFileTime to copy, combining the two you can do exactly as 'described/wanted'

Resources