Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello together,
My job runs daily and relies on a lot of Excel files.
I get the following error: Invalid header signature; read 0x0000020007160500, expected 0xE11AB1A1E011CFD0 - Your file appears not to be a valid OLE2 document
And when I look into the files, I see it's caused by this "ghost file". If I just erase it, the job runs normally.
It happended every two or three months, but these days, it happends daily. These files have been created manually and didn't change since, so I guess the "ghost file" (sorry I don't know the technical term :/) is created by the job itself.
Any ideas so that the problem doesn't happen anymore?
Many thanks,
Best greetings,
HungryOctopus
Hey Sabrina,
Thanks, I made some adjustments to your solution but the logic helped me!
Here the Ghost Buster components:
tFileList -> tFileProperties -> tJavaRow
In the tJavaRow, I check if the file is empty or broken with following code:
globalMap.put("FileName", row14.basename);
// First condition: Check if the file/data structure is empty
if (row14.size == 0) {
globalMap.put("isEmpty", true);
} else {
globalMap.put("isEmpty", false);
}
// Second condition: Check if the basename of the file starts with "._"
if (row14.basename.startsWith("._")) {
globalMap.put("isBroken", true);
} else {
globalMap.put("isBroken", false);
}
If a file is broken, the file will be deleted:
((Boolean)globalMap.get("isEmpty")) || ((Boolean)globalMap.get("isBroken"))
If it is not empty or broken, the file will be read and proceed:
((Boolean)globalMap.get("isEmpty")) == false && ((Boolean)globalMap.get("isBroken")) == false
The only thing is, even if the excel is empty, the filesize is still bigger than 0, so we should use something else to check this.
Best Regards,
HungryOctopus
Hello,
Are your ghost files empty? If so, you are able to delete them via tFileDelete component. With tFileProperties you can access the file length parameter and decide to delete the empty file or not in RunIf trigger.
Here is the design:
tFileList--(iterate)-->tFileProperties--(main)-->tFlowToIterate--(OnComponentOk)--(If)-->tFileDelete
Feel free to let us know if it helps.
Best regards
Sabrina
Hey Sabrina,
Thanks, I made some adjustments to your solution but the logic helped me!
Here the Ghost Buster components:
tFileList -> tFileProperties -> tJavaRow
In the tJavaRow, I check if the file is empty or broken with following code:
globalMap.put("FileName", row14.basename);
// First condition: Check if the file/data structure is empty
if (row14.size == 0) {
globalMap.put("isEmpty", true);
} else {
globalMap.put("isEmpty", false);
}
// Second condition: Check if the basename of the file starts with "._"
if (row14.basename.startsWith("._")) {
globalMap.put("isBroken", true);
} else {
globalMap.put("isBroken", false);
}
If a file is broken, the file will be deleted:
((Boolean)globalMap.get("isEmpty")) || ((Boolean)globalMap.get("isBroken"))
If it is not empty or broken, the file will be read and proceed:
((Boolean)globalMap.get("isEmpty")) == false && ((Boolean)globalMap.get("isBroken")) == false
The only thing is, even if the excel is empty, the filesize is still bigger than 0, so we should use something else to check this.
Best Regards,
HungryOctopus