473,626 Members | 3,289 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

File.Move large binary file

Hi,

How does File.Move implmented?
I am like to use it a lot but when I come a cross a large file >500 MB
my UI is freezed.

I think about implement my own fileMove function but I am not sure what
is the efficient way to implement it. There are many thing in the
System.IO such as BinaryRead, BinaryWrite FileStream etc.

Please advice me on how to handle file.move for large binary file.

Many thanks,
kids
Nov 21 '05 #1
5 4825
Even if you implement your own function, UI is still likely to hang
unless you make use of async IO. I think it is better to still use
File.Move, but call it on a different thread.

Nov 21 '05 #2
When the file is in the same partition, it is renamed. When on different
partitions, the file is copied and then deleted from source. For large
files, this is just going to take time, so I would not do this operation on
the UI thread. Create a backgroundworke r.

--
William Stacey [MVP]

"kids_pro" <ki******@yahoo .com> wrote in message
news:Ou******** ******@TK2MSFTN GP15.phx.gbl...
Hi,

How does File.Move implmented?
I am like to use it a lot but when I come a cross a large file >500 MB my
UI is freezed.

I think about implement my own fileMove function but I am not sure what is
the efficient way to implement it. There are many thing in the System.IO
such as BinaryRead, BinaryWrite FileStream etc.

Please advice me on how to handle file.move for large binary file.

Many thanks,
kids

Nov 21 '05 #3
William Stacey [MVP] wrote:
When the file is in the same partition, it is renamed. When on different
partitions, the file is copied and then deleted from source. For large
files, this is just going to take time, so I would not do this operation on
the UI thread. Create a backgroundworke r.

Is it possible to show the progress (in progress bar) during file move?
Go backgroundworke r way.
Nov 23 '05 #4
yes. Examples should be on google.

--
William Stacey [MVP]

"kids_pro" <ki******@yahoo .com> wrote in message
news:uC******** ******@TK2MSFTN GP14.phx.gbl...
William Stacey [MVP] wrote:
When the file is in the same partition, it is renamed. When on different
partitions, the file is copied and then deleted from source. For large
files, this is just going to take time, so I would not do this operation
on the UI thread. Create a backgroundworke r.

Is it possible to show the progress (in progress bar) during file move?
Go backgroundworke r way.

Nov 23 '05 #5
More on this, note that you don't know the actual progress of
File.Move. You could guess that base on the file size, but it is not
exact. Maybe better just displaying a label saying file is copying.

Nov 23 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
2604
by: spike | last post by:
Im writing a program to search for a string in a binary file. And it works. The problem is: It is sooo slow! how can i make it faster? It takes 27 seconds just to search a 5 meg file. I guess it has something to do with the strequal() function... Btw, thanks to all of you who answered last time! code: ------------------------------------------------------------------------- #include <stdio.h>
2
4188
by: TOI DAY | last post by:
I have a large file, I want to be to open the first file in a stream, read a chunk (say 1024 bytes) and stick it in a byte array, open the second file in a different stream, read a chuck (the same size as before), compare the two arrays and, if they match, then move to the next chunk. Does anyone have any example for this. Please post it Thanks in advance
15
1738
by: Yogi_Bear_79 | last post by:
Visual Studio .NET started complaing when the array was around 4000. I found that if I pasted the array in via notepad then opened Visual Studio it would work. Now my array is over 26,000 and Visual Studio just doesn't like it. Everytime I open the prokect I get the following error: "An Error occurred which the C# comipler is unable to report due to low memory or possible heap corruption. It is recommended that you save all your files,...
1
5375
by: Roy | last post by:
Hi, I have a problem that I have been working with for a while. I need to be able from server side (asp.net) to detect that the file i'm streaming down to the client is saved completely/succsessfully on the client's computer before updating some metadata on the server (file downloaded date for instance) However, All examples i have tried, and all examples I have found that other people says works - doesn't work for me :-(
1
3047
by: Matthew Eno | last post by:
I have a problem where I'm developing some code that moves files from one place to another (on the same drive) with the destination file having a new name. What's happening is that the line of code where I do the file.move is taking a very long time (in the order of around 7 seconds for a simple 30kb file). The only thing that I can think may be causing the problem is that theere is around 1.1 million files to move, so perhaps it's the
2
4625
by: gauravkhanna | last post by:
Hi All I need some help for the below problem: Scenario We need to send large binary files (audio file of about 10 MB or so) from the client machine (.Net Windows based application, located outside the home network) to the Web Server and then retrieve the file back from the web server to the client.
6
5097
by: Brybot | last post by:
I am trying to allow HTTP POST file uploads to my web service. Currently I have it working perfectly for a SOAP/XML request reading in a byte using MemoryStream/FileStream but I cannot figure out how to encode a file on a POST to the same web service. The definition requires a base64binary encoded file, which I have tried. The form is also using a mutlipart/form-data enctype, but I either get a 500 error or 'Request format is invalid'. ...
31
2492
by: broli | last post by:
I need to parse a file which has about 2000 lines and I'm getting told that reading the file in ascii would be a slower way to do it and so i need to resort to binary by reading it in large chunks. Can any one please explain what is all this about ?
11
3808
by: itdevries | last post by:
Hi, I'm trying to convert some char data I read from a binary file (using ifstream) to a float type. I've managed to convert the int types but now I need to do the float types as well but it doesn't seem to work. The code below is what I'm trying to use. Anyone see any obvious errors? or have any hints/pointers? regards, Igor float floatRead = 0;
0
8272
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8205
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8713
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8644
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8370
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8514
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6126
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4094
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
1817
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.