Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8189699
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T03:22:16+00:00 2026-06-07T03:22:16+00:00

Its quite weird,i have a console application that reads media file and extract some

  • 0

Its quite weird,i have a console application that reads media file and extract some data from media file using third party dll (MediaInfo.dll)

and then i upload that file to some other location from the source then finally i delete that file in the souce once everything is don.

Below is my code for deletion.

                    GC.Collect();
                    FileInfo[] fiListImages = (new DirectoryInfo(mfsData.Images)).GetFiles(String.Format("*{0}*", sp.Story.Slug));
                    foreach (FileInfo fi in fiListImages)
                    {

                        bool ImageFolder = fi.Directory.Name.Contains("Images");
                        if (ImageFolder)
                        {

                            File.Delete(fi.FullName);

                        }
                    }

                    FileInfo[] fiListMedia = (new DirectoryInfo(mfsData.EncodedMedia)).GetFiles(String.Format("*{0}*", sp.Story.Slug), SearchOption.AllDirectories);
                    foreach (FileInfo fi in fiListMedia)
                    {



                        if (sp.Profile.Name == "Comedy" && fi.FullName.Contains(@"\Comedy"))
                        {
                            File.Delete(fi.FullName);
                        }
                        else if (sp.Profile.Name == "Actuib" && ((fi.FullName.Contains(@"\Action") || (fi.FullName.Contains(@"\Syndicated")))))
                        {
                            File.Delete(fi.FullName);
                        }


                    }

I just want to call the garbage collector before start deletion ( i thought this will help me to remove all the locks but am wrong).

The code is working really good some times and sometimes it throws this exception “Process cannot access the file because it is being used by another process”.

I can suspect another place when i load the media file to the third party library like below

                videoInterrogator.LoadFile(filename);
                logger.Info("video interrogar extract the video files");
                message.AppendFormat(messageFormat, "FileSize", videoInterrogator.GetFileSize(), Environment.NewLine);
                message.AppendFormat(messageFormat, "MaxBitRate", videoInterrogator.maxBitRate(), Environment.NewLine);
                logger.Info("Video Extract done");

after get in to this piece of code when i try to delete that file manually i get the same error message and am not sure how to close the connection forcefully to release the file.

Any help much appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T03:22:19+00:00Added an answer on June 7, 2026 at 3:22 am

    More information about videoInterrogator would definitely be useful. Try checking its documentation. If it implements IDisposable try calling Dispose() on the object once you’re done. If it’s a COM object call Marshal.ReleaseComObject().

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have recently started diving into Haskell. Its quite interesting, but the definition of
I'm learning JQuery and have found the factory function $() with its selectors quite
i have a quite weird question which probably has no practical use but the
Having a weird issue. I'm new to Macs and have a windows VM that
I have a PHP script that loops through some urls. The urls are stored
I can't quite figure out why. But I have some code which uses PIE.htc
I was trying to get some info from documentation, but it seems that it
I have some really weird crash here, ive got it before, but i thought
I have a sql table that gets populated via SQLBulkCopy from Excel. The copy
I have weird situation in newly installed server, and it seems that Google can't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.