Apache NIFI, rename compressed file without changing the name of the content file - zip

I have issues trying to rename a compressed file using the processor CompressContent.
I need to rename a flowfile to content.txt, then compress it using a different file name (e.g: compressed.gz)
To accomplish that, I'm using these processors:
ConvertRecord > UpdateAttribute > CompressContent > UpdateAttribute
Flow_diagram ,
Update_config , Compress_config
But there is a problem, if I rename the compressed file it also affects the name of the txt file (making it unusable).
Is it possible to rename the compressed file without changing the name of the txt file?
Thanks in advance.

Related

Is there a tool to extract a file from a ZIP archive when that file is not present in central directory but has its own LFH?

I'm looking for a tool that can extract files by searching aggressively through a ZIP archive. The compressed files are preceded with LFHs but no CDHs are present. Unzip outputs an empty folder.
I found one called 'binwalk' but even though it finds the hidden files inside ZIP archives it seems not to know how to extract them.
Thank You in advance.
You can try sunzip. It reads the zip file as a stream, and will extract files as it encounters the local headers and compressed data.
Use the -r option to retain the files decompressed in the event of an error. You will be left with a temporary directory starting with _z containing the extracted files, but with temporary, random names.

how to store multiple files in one file in python?

How can I store multiple files in one file using python?
I mean my own file format not a zip or a rar.
For e.g I want to create an archive from a folder but with my own file format. ( like 'Files.HR' )
Or just storing files in one file without any dictionary or file format. ( 'Files' No file format )
You may want to use "tar" files. In python, you can use the tarfile module to write files in the file and then later extract them back into real files.
You do not have to name the file *.tar. You can name it something else related to your specific application, such as naming it Files.HR.
Please see this nice tutorial or read the official docs to see how to use tarfile.

How to input multiple csv files in logstash (Elasicsearch). please give one simple example.

How to input multiple csv files in logstash (Elasicsearch). please give one simple example.
if I have five csv files in one folder & still new files may get created in same location so how can I process all new files also in logstash.
change in file path only. ( path => "/home/mahadev/data/*.csv)
So now we can able to read all csv files inside the data folder. if any new csv comes then it will get reflect into logstash.
Please note: the above file path we need to put in logstash's conf file. if you are new then please read about logstash configration file then read this.

I want to add addtional files to existing archives (ZIP / RAR) or have the files added when compressing

I know how to do this for one archive at a time, but I want to add files, to multiple archives, in the same folder, simultaneously; if that is possible. I understand that I can do this with a batch file... but I don't know how to write the script / text.
So... I have several zip files in one folder. I want to add a specific text file and a specific image file to each/all of those zips. I don't want any other modifications of the zip files.
Or... is there a way to set WinRAR so that specific files will be automatically added whenever an archive is created?
Thanks
import zipfile
z = zipfile.ZipFile('cal.zip', mode='a', compression=zipfile.ZIP_DEFLATED)
z.write('/your/file/path') # or, z.writestr('your-filename', 'file-content')
z.close()

Find data file in Zip file using microcontroller

I need a microcontroller to read a data file that's been stored in a Zip file (actually a custom OPC-based file format, but that's irrelevant). The data file has a known name, path, and size, and is guaranteed to be stored uncompressed. What is the simplest & fastest way to find the start of the file data within the Zip file without writing a complete Zip parser?
NOTE: I'm aware of the Zip comment section, but the data file in question is too big to fit in it.
I ended up writing a simple parser that finds the file data in question using the central directory.

Resources