Application freezes when trying to read Author from .doc multiple files

Stern Edi

I'm trying to make an app that displays all authors of .doc files from a Folder and its subfolders, the problem is that I used Directory.GetFiles("*.doc", SearchOption.AllDirectories) and when I'm trying to read from a folder with very much files, the app freeze in this point. Here is my code

FileInfo[] Files = dir.GetFiles("*.doc", SearchOption.AllDirectories);
foreach(FileInfo file in Files) 
{
    try
    {
        //ConvertDOCToDOCX(file.FullName);
        using(WordprocessingDocument sourcePresentationDocument = WordprocessingDocument.Open(file.FullName, false)) 
        {
            metadataList.Add(new Metadata() 
            {
                Name = "Title", Value = file.Name
            });
            metadataList.Add(new Metadata() 
            {
                Name = "Author", Value = sourcePresentationDocument.PackageProperties.Creator
            });
            metadataList.Add(new Metadata() 
            {
                Name = "", Value = ""
            });
        }
    }
}
Cadburry

I think you dont need this "WordprocessingDocument" - this is producing a heavy load - you can just read the meta-information via .net default file methods.

For an example, you should take a look at Read/Write 'Extended' file properties (C#)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Kettle - Read multiple files from a folder

From Dev

Form Freezes When Moving Files

From Dev

Run time error 5981 when trying to create MS Word doc files from Access

From Dev

Xcode freezes when trying to execute this in a Swift playground?

From Dev

How to read multiple files from a resource directory

From Dev

Read multiple files from folder in perl

From Dev

Read lines from multiple files python

From Dev

Read values from multiple files in IDL

From Dev

rsync read from multiple list of files

From Dev

Read multiple files from concatenated gzip in Python

From Dev

How to read or copy text from .docx/.odt/.doc files

From Dev

read multiple files with php from directory

From Dev

BIOS freezes when trying to boot from Ubuntu 18.04 LTS live-usb

From Dev

NullPointerException when trying to read from a text file

From Dev

Read multiple lines from text files in bash

From Dev

Run time error 5981 when trying to create MS Word doc files from Access

From Dev

System.OutOfMemory exception when trying to read large files

From Dev

Issue when trying to read files from a sharepoint/network location in C#

From Dev

How to read multiple files from a resource directory

From Dev

Centos freezes, when trying to open crontab

From Dev

read multiple text files from multiple folders

From Dev

How to read Word .doc files?

From Dev

Java read integer arrays from multiple files

From Dev

How to read or copy text from .docx/.odt/.doc files

From Dev

JavaFX application Window freezes when trying to show the backgroud process status

From Dev

The native application freezes when starting

From Dev

Error when trying to read to read from Entry

From Dev

Trying to read multiple files of different lengths into an array in R

From Dev

Read multiple JSON files from a folder into a map

Related Related

  1. 1

    Kettle - Read multiple files from a folder

  2. 2

    Form Freezes When Moving Files

  3. 3

    Run time error 5981 when trying to create MS Word doc files from Access

  4. 4

    Xcode freezes when trying to execute this in a Swift playground?

  5. 5

    How to read multiple files from a resource directory

  6. 6

    Read multiple files from folder in perl

  7. 7

    Read lines from multiple files python

  8. 8

    Read values from multiple files in IDL

  9. 9

    rsync read from multiple list of files

  10. 10

    Read multiple files from concatenated gzip in Python

  11. 11

    How to read or copy text from .docx/.odt/.doc files

  12. 12

    read multiple files with php from directory

  13. 13

    BIOS freezes when trying to boot from Ubuntu 18.04 LTS live-usb

  14. 14

    NullPointerException when trying to read from a text file

  15. 15

    Read multiple lines from text files in bash

  16. 16

    Run time error 5981 when trying to create MS Word doc files from Access

  17. 17

    System.OutOfMemory exception when trying to read large files

  18. 18

    Issue when trying to read files from a sharepoint/network location in C#

  19. 19

    How to read multiple files from a resource directory

  20. 20

    Centos freezes, when trying to open crontab

  21. 21

    read multiple text files from multiple folders

  22. 22

    How to read Word .doc files?

  23. 23

    Java read integer arrays from multiple files

  24. 24

    How to read or copy text from .docx/.odt/.doc files

  25. 25

    JavaFX application Window freezes when trying to show the backgroud process status

  26. 26

    The native application freezes when starting

  27. 27

    Error when trying to read to read from Entry

  28. 28

    Trying to read multiple files of different lengths into an array in R

  29. 29

    Read multiple JSON files from a folder into a map

HotTag

Archive