Fast Rename from client to server

G

Guest

I have a C# client app that sometimes needs to do thousands of specialized
file renames of files on a file server in the same domain. If the files
reside locally on the client machine, the renames take only a few seconds.
If the files reside on the file server, a set of 30,000 file renames may take
a half hour to do.

I'm just using File.Move to do the rename. The renames are not moving the
files to a different folder, they are just changing the name of the file.

I'm assuming that network latency between each of the File.Move calls is
what is slowing the renaming down so much.

Is there a way to batch up all 30,000 File.Move commands to the server,
rather than sending them each one at a time so that I am not paying the price
of the network latency between every single file rename? Or is there a
better way to speed this up? It needs to be almost as fast as doing it
locally on the client.
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

No, you cannot batch them.

Can you install/run a remote program in the server?
You could send the execution to the remote service which will do it locally.

That would be the practical solution from my point of view.
 
G

Guest

That wouldn't be easy to do because not all of the servers are Windows
machines, and I'm not certain how to write a service on the non-windows
platforms. Is there not some other way to speed this up?
 
R

Ryan Liu

Hi Don,

Another consideration is why you need change so many file names. Can you do
some file name mapping in your application? You just change the
relationship in the mapping hash and do not change real file name.

HTH,
Ryan
 
P

Peter Huang [MSFT]

Hi,

I think for non-Windows platform, you may also try to write a remote
program.
Commonly the TCP/IP is implemented on almost all the platform, e.g. linux,
unix.
You can write a server application on the linux or unix, and listen to
certain port and the send the files you want to rename.


Best regards,

Peter Huang

Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,


Renaming that many files remotely will be slow, no matter what method you
use.
Your best approach is to write a OS dependand service , you better do it in
C or C++ as it's almost 100% compatible across the different OSes. You will
have to use TCP to send the commands
 
G

Guest

Sounds like there's no magic bullet here like I was hoping. It's too bad
there's no way to batch up the commands rather than having to send them each
one at a time.

Thanks for your suggestions!
 
W

Willy Denoyette [MVP]

That service exists, it's called WMI.

Willy.

"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> wrote
in message | Hi,
|
|
| Renaming that many files remotely will be slow, no matter what method you
| use.
| Your best approach is to write a OS dependand service , you better do it
in
| C or C++ as it's almost 100% compatible across the different OSes. You
will
| have to use TCP to send the commands
|
|
| --
| Ignacio Machin,
| ignacio.machin AT dot.state.fl.us
| Florida Department Of Transportation
|
|
| | > That wouldn't be easy to do because not all of the servers are Windows
| > machines, and I'm not certain how to write a service on the non-windows
| > platforms. Is there not some other way to speed this up?
| >
| > "Ignacio Machin ( .NET/ C# MVP )" wrote:
| >
| >> Hi,
| >>
| >> No, you cannot batch them.
| >>
| >> Can you install/run a remote program in the server?
| >> You could send the execution to the remote service which will do it
| >> locally.
| >>
| >> That would be the practical solution from my point of view.
| >>
| >>
| >>
| >> --
| >> Ignacio Machin,
| >> ignacio.machin AT dot.state.fl.us
| >> Florida Department Of Transportation
| >>
| >> | >> >I have a C# client app that sometimes needs to do thousands of
| >> >specialized
| >> > file renames of files on a file server in the same domain. If the
| >> > files
| >> > reside locally on the client machine, the renames take only a few
| >> > seconds.
| >> > If the files reside on the file server, a set of 30,000 file renames
| >> > may
| >> > take
| >> > a half hour to do.
| >> >
| >> > I'm just using File.Move to do the rename. The renames are not
moving
| >> > the
| >> > files to a different folder, they are just changing the name of the
| >> > file.
| >> >
| >> > I'm assuming that network latency between each of the File.Move calls
| >> > is
| >> > what is slowing the renaming down so much.
| >> >
| >> > Is there a way to batch up all 30,000 File.Move commands to the
server,
| >> > rather than sending them each one at a time so that I am not paying
the
| >> > price
| >> > of the network latency between every single file rename? Or is there
a
| >> > better way to speed this up? It needs to be almost as fast as doing
it
| >> > locally on the client.
| >> >
| >>
| >>
| >>
|
|
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

Willy Denoyette said:
That service exists, it's called WMI.

I find it difficult that WMI runs on a non Win OS , the OP said some of the
servers run another OS
 
W

Willy Denoyette [MVP]

"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> wrote
in message | Hi,
|
| | > That service exists, it's called WMI.
|
| I find it difficult that WMI runs on a non Win OS , the OP said some of
the
| servers run another OS
|
|
| --
| Ignacio Machin,
| ignacio.machin AT dot.state.fl.us
| Florida Department Of Transportation
|
|

This shouldn't be an issue, WBEM (MSFT's implementation is called WMI) is
available for most commercial OS like Linux, Netware, AIX, HP-UX, there are
even a number of open-source implementations available.

Willy.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top