471,337 Members | 1,266 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,337 software developers and data experts.

moving/renaming directory to 2 levels below

why the heck can't I use Directory.Move() to rename a directory (containing
files) to a entry 2 levels below e.g.

uploads/tempfiles
-> uploads/tempfiles/48/003files

if I do this in one line it says "part of the file name not found" bla bla
so I move it in two steps but then in the second step it says "the file is
being used by another process"

Is this impossible to do????
ps i'm using c#/asp.net 2.0
Jan 19 '06 #1
3 1705
Daves,

This is more a logic issue than anything.

If you want to move uploads/tempfiles (directory included), then you are
basically eliminating the directory.

If anything, you need to copy the files over, and not the whole
directory. You can't just "expand" a path in that way.

What you should do is in the uplocats/tempfiles directory is to take all
the files and all of the directories, and copy them to new subdirectories
that you create.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Daves" <db****@simnet.is> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
why the heck can't I use Directory.Move() to rename a directory
(containing files) to a entry 2 levels below e.g.

uploads/tempfiles
-> uploads/tempfiles/48/003files

if I do this in one line it says "part of the file name not found" bla bla
so I move it in two steps but then in the second step it says "the file is
being used by another process"

Is this impossible to do????
ps i'm using c#/asp.net 2.0

Jan 19 '06 #2
well I need to MOVE it not copy, I simplified the code below, actually I'm
moving
"~/uploads/Forums/tempfiles123412"

to

"~/uploads/Forums/102/43files"

(the folder name refers to ForumID and MessageID)

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:%2****************@TK2MSFTNGP09.phx.gbl...
Daves,

This is more a logic issue than anything.

If you want to move uploads/tempfiles (directory included), then you
are basically eliminating the directory.

If anything, you need to copy the files over, and not the whole
directory. You can't just "expand" a path in that way.

What you should do is in the uplocats/tempfiles directory is to take
all the files and all of the directories, and copy them to new
subdirectories that you create.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Daves" <db****@simnet.is> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
why the heck can't I use Directory.Move() to rename a directory
(containing files) to a entry 2 levels below e.g.

uploads/tempfiles
-> uploads/tempfiles/48/003files

if I do this in one line it says "part of the file name not found" bla
bla so I move it in two steps but then in the second step it says "the
file is being used by another process"

Is this impossible to do????
ps i'm using c#/asp.net 2.0


Jan 19 '06 #3
Hi,

"Daves" <db****@simnet.is> wrote in message
news:%2******************@TK2MSFTNGP09.phx.gbl...
well I need to MOVE it not copy, I simplified the code below, actually I'm
moving
"~/uploads/Forums/tempfiles123412"

to

"~/uploads/Forums/102/43files"


Well this is a complete different scenario, just create the dir and move the
files, you create the dir path using Directory.CreateDirectory, this will
create ALL the levels, then you move the files over

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

Jan 19 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Anand K Rayudu | last post: by
1 post views Thread by Don Leverton | last post: by
1 post views Thread by Jason B | last post: by
6 posts views Thread by Woody Splawn | last post: by
14 posts views Thread by Realtime | last post: by
4 posts views Thread by Rafael Tejera | last post: by
2 posts views Thread by David Thielen | last post: by

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.