473,387 Members | 1,574 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 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 1788
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Anand K Rayudu | last post by:
Hi all, I am trying to find a way to get the files recursively in a given directory, The following code is failing, can some one please suggest what could be problem here from os import...
1
by: Don Leverton | last post by:
Hi Folks, I have been given a CD with approx 130 .xls files (bean-counters!) that I would like to import and merge to ONE table (tblTradeshow). The XL files are *similarly*, but not...
1
by: Jason B | last post by:
Hello, I have been trying to figure out how to rename my IIS directories and still have the project be able to run through VS. I have renamed the directories listed in the csproj.webinfo file and...
0
by: Michael Johnson Sr. | last post by:
I have an application which I developed in C# ASP.NET. It uses SQL Server which is on a Virtual PC using Virtual PC 2004. It works great, no problems. I moved the user controls, aspx files,...
6
by: Woody Splawn | last post by:
I have been using SQL Server 2000 on my stand-alone machine as a back-end to a VS.net application. It is time to switch environments and take the application to the customer. I need to install...
14
by: Realtime | last post by:
Lets say i have a file with the name atest.doc and its in the directory www/directory1 but i want to move that file using php to www/directory2/ how do i do this i tried move_uploaded_file()...
4
by: Rafael Tejera | last post by:
I'm moving some code from my old pc. I'm using VS NET 2003 C# and MSSQL 2003. Everything is in place, but I'm receiving this error messages. thansk for you help... Here is the error...
1
by: rush81 | last post by:
i'm trying to create an ssis package for renaming and moving the file. It gives error at the file system task: Error: An error occurred with the following error message: "Could not find file...
2
by: David Thielen | last post by:
So we have moved our app from .NET version 2.X in IIS6 to a Windows 2008 Server running IIS7. We have copied all files to the Windwardreports\apps directory and that apps directory has been...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...
0
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...

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.