changing folder name

P

Paul

I did a google search but could find what I was looking for. I am creating a
temporary folder and placing files in it with a web application. The
temporary folder name needs to be changed dynamically by the program, leaving
all the files in the folder. Just wondering if anyone has done this?
thanks.
 
G

Göran Andersson

Paul said:
I did a google search but could find what I was looking for. I am creating a
temporary folder and placing files in it with a web application. The
temporary folder name needs to be changed dynamically by the program, leaving
all the files in the folder. Just wondering if anyone has done this?
thanks.

You use the Directory.Move method to rename a directory.
 
G

George

Be carefull here....
By changing folder's name you will restart an applicaition (if it's a
subfolder in application folder) even if the subfolder does not have single
..aspx file

George
 
P

Paul

Thanks for all the responses. The folder will contain image files and .doc
files. It is currently located as a subfolder in the web project so think I
may have to place it in a different location, will give it a try.--
Paul G
Software engineer.


George said:
Be carefull here....
By changing folder's name you will restart an applicaition (if it's a
subfolder in application folder) even if the subfolder does not have single
..aspx file

George
 
P

Paul

Hi I did not see a System.IO.Directory class,just compression,
isolatedstorage and ports. wondering if I am missing a reference? This is a
web application using framework 2.
Thanks.
--
Paul G
Software engineer.


Eliyahu Goldin said:
System.IO.Directory class, method Move(). You will need to make sure the app
process has sufficient security rights.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
 
P

Paul

Hi it looks like it is resetting the application as you stated,
target.MoveTo(Server.MapPath(newpath));//copy to new directory
I do not want to hardcode a path in since the application is moved to
different servers but wondering if there is a way to do this using something
simular to Server.MapPath. Only think is it can not be in a subfolder of the
project (so it will not cause a reset!). Also wondering if a copy and then
delete would cause a reset as well (if in a subfolder of the project?)Thanks.
--
Paul G
Software engineer.


George said:
Be carefull here....
By changing folder's name you will restart an applicaition (if it's a
subfolder in application folder) even if the subfolder does not have single
..aspx file

George
 
E

Eliyahu Goldin

Renaming directories from a web app doesn't look like an elegant solution.
Perhaps you should explain in short what do you want to achieve.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net


Paul said:
Hi it looks like it is resetting the application as you stated,
target.MoveTo(Server.MapPath(newpath));//copy to new directory
I do not want to hardcode a path in since the application is moved to
different servers but wondering if there is a way to do this using
something
simular to Server.MapPath. Only think is it can not be in a subfolder of
the
project (so it will not cause a reset!). Also wondering if a copy and
then
delete would cause a reset as well (if in a subfolder of the
project?)Thanks.
 
P

Paul

thanks for the response. I am setting up a data storage area for reports and
am allowing users to store files that are associated with a report. The
report just collects a bunch of information and the report number is
generated based on this information entered. I am just using a temp folder
as am allowing uploading before the report is saved (as they are entering the
data). When the report is saved the temp folder name (just using the user
ID) needs to be changed to the report number, so it is like
Temp/ReportNumber/all the files.
--
Paul G
Software engineer.


Eliyahu Goldin said:
Renaming directories from a web app doesn't look like an elegant solution.
Perhaps you should explain in short what do you want to achieve.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
 
E

Eliyahu Goldin

I see.

You can try creating a virtual directory in IIS under your application root,
map it to a physical folder outside the application root and store the
reports there. But I am afraid this may restart the application too.

You can also setup a parameter in the web.config that will tell you the
physical path to the report data storage.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net


Paul said:
thanks for the response. I am setting up a data storage area for reports
and
am allowing users to store files that are associated with a report. The
report just collects a bunch of information and the report number is
generated based on this information entered. I am just using a temp
folder
as am allowing uploading before the report is saved (as they are entering
the
data). When the report is saved the temp folder name (just using the user
ID) needs to be changed to the report number, so it is like
Temp/ReportNumber/all the files.
--
Paul G
Software engineer.


Eliyahu Goldin said:
Renaming directories from a web app doesn't look like an elegant
solution.
Perhaps you should explain in short what do you want to achieve.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net


Paul said:
Hi it looks like it is resetting the application as you stated,
target.MoveTo(Server.MapPath(newpath));//copy to new directory
I do not want to hardcode a path in since the application is moved to
different servers but wondering if there is a way to do this using
something
simular to Server.MapPath. Only think is it can not be in a subfolder
of
the
project (so it will not cause a reset!). Also wondering if a copy and
then
delete would cause a reset as well (if in a subfolder of the
project?)Thanks.
--
Paul G
Software engineer.


:

Be carefull here....
By changing folder's name you will restart an applicaition (if it's a
subfolder in application folder) even if the subfolder does not have
single
..aspx file

George


I did a google search but could find what I was looking for. I am
creating
a
temporary folder and placing files in it with a web application.
The
temporary folder name needs to be changed dynamically by the
program,
leaving
all the files in the folder. Just wondering if anyone has done
this?
thanks.
 
P

Paul

thanks for the additional information. I had thought of setting the
parameter as you suggested, then I think the application could still be moved
with a rebuild. I also thought of a seperate windows application to run at
night that would clear the temp directories as long as it could figure out
which ones to clear.
--
Paul G
Software engineer.


Eliyahu Goldin said:
I see.

You can try creating a virtual directory in IIS under your application root,
map it to a physical folder outside the application root and store the
reports there. But I am afraid this may restart the application too.

You can also setup a parameter in the web.config that will tell you the
physical path to the report data storage.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net


Paul said:
thanks for the response. I am setting up a data storage area for reports
and
am allowing users to store files that are associated with a report. The
report just collects a bunch of information and the report number is
generated based on this information entered. I am just using a temp
folder
as am allowing uploading before the report is saved (as they are entering
the
data). When the report is saved the temp folder name (just using the user
ID) needs to be changed to the report number, so it is like
Temp/ReportNumber/all the files.
--
Paul G
Software engineer.


Eliyahu Goldin said:
Renaming directories from a web app doesn't look like an elegant
solution.
Perhaps you should explain in short what do you want to achieve.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net


Hi it looks like it is resetting the application as you stated,
target.MoveTo(Server.MapPath(newpath));//copy to new directory
I do not want to hardcode a path in since the application is moved to
different servers but wondering if there is a way to do this using
something
simular to Server.MapPath. Only think is it can not be in a subfolder
of
the
project (so it will not cause a reset!). Also wondering if a copy and
then
delete would cause a reset as well (if in a subfolder of the
project?)Thanks.
--
Paul G
Software engineer.


:

Be carefull here....
By changing folder's name you will restart an applicaition (if it's a
subfolder in application folder) even if the subfolder does not have
single
..aspx file

George


I did a google search but could find what I was looking for. I am
creating
a
temporary folder and placing files in it with a web application.
The
temporary folder name needs to be changed dynamically by the
program,
leaving
all the files in the folder. Just wondering if anyone has done
this?
thanks.
 
P

Paul

oops I ment app moved without a rebuild of the source code.
--
Paul G
Software engineer.


Paul said:
thanks for the additional information. I had thought of setting the
parameter as you suggested, then I think the application could still be moved
with a rebuild. I also thought of a seperate windows application to run at
night that would clear the temp directories as long as it could figure out
which ones to clear.
--
Paul G
Software engineer.


Eliyahu Goldin said:
I see.

You can try creating a virtual directory in IIS under your application root,
map it to a physical folder outside the application root and store the
reports there. But I am afraid this may restart the application too.

You can also setup a parameter in the web.config that will tell you the
physical path to the report data storage.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net


Paul said:
thanks for the response. I am setting up a data storage area for reports
and
am allowing users to store files that are associated with a report. The
report just collects a bunch of information and the report number is
generated based on this information entered. I am just using a temp
folder
as am allowing uploading before the report is saved (as they are entering
the
data). When the report is saved the temp folder name (just using the user
ID) needs to be changed to the report number, so it is like
Temp/ReportNumber/all the files.
--
Paul G
Software engineer.


:

Renaming directories from a web app doesn't look like an elegant
solution.
Perhaps you should explain in short what do you want to achieve.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net


Hi it looks like it is resetting the application as you stated,
target.MoveTo(Server.MapPath(newpath));//copy to new directory
I do not want to hardcode a path in since the application is moved to
different servers but wondering if there is a way to do this using
something
simular to Server.MapPath. Only think is it can not be in a subfolder
of
the
project (so it will not cause a reset!). Also wondering if a copy and
then
delete would cause a reset as well (if in a subfolder of the
project?)Thanks.
--
Paul G
Software engineer.


:

Be carefull here....
By changing folder's name you will restart an applicaition (if it's a
subfolder in application folder) even if the subfolder does not have
single
..aspx file

George


I did a google search but could find what I was looking for. I am
creating
a
temporary folder and placing files in it with a web application.
The
temporary folder name needs to be changed dynamically by the
program,
leaving
all the files in the folder. Just wondering if anyone has done
this?
thanks.
 

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

Members online

Forum statistics

Threads
473,772
Messages
2,569,593
Members
45,109
Latest member
JanieMalco
Top