An inquisitive question......
A ListBox lists all the directories & files residing in a directory on
the server. Assume that the ListBox lists 2 directories & 4 files. Also
assume that one of the directories is named 'mydir' (without the
quotes). Note that the all the letters in the directory name are in
lowercase.
To rename any directory/file, one can use the Move method of the
Directory/File class respectively but ASP.NET doesn't allow to JUST
change the case of a directory/file name. For e.g. if I want to change
the name of the directory from 'mydir' to 'MYDIR', ASP.NET generates
the following error:
Source and destination path must be different.
when the Move method of the Directory class is invoked. This, I
believe, is obvious because the Move method is primarily meant for
moving a directory/file from one location to another location.
Hasn't Microsoft included any method in the ASP.NET Framework to
exclusively rename a directory/file. Isn't there any way by which I can
change the directory name from 'mydir' to 'MYDIR'?
Though strictly speaking, changing the directory name from 'mydir' to
'MYDIR' doesn't amount to renaming; it's merely changing the case of
the directory name.
Note that if you navigate to 'mydir' from 'My Computer', then Windows
does allow users to change the directory name from 'mydir' to 'MYDIR'
i.e. Windows allows users to just change the case of a directory/file
name without generating any error. 3 3614
This is because the Windows file system is not case-sensitive. What you have
to do is to create a temporary folder, move the contents of the "mydir"
folder to the temporary folder, delete the "mydir" folder, create a new
folder named "MYDIR," move the contents of the temp folder to the "MYDIR"
folder, and delete the temp folder.
couldn't you rename the temp folder to "MYDIR", after removing the
original "mydir"? Saves maybe a lot of copying.
Or now that I think about it some more, what about renaming "mydir" to
some different name ("mydir-temp") and then renaming that to "MYDIR"?
Both would be "real" renames to a case-insensitive filesystem.
Hans Kesting
"Hans Kesting" <ne***********@ spamgourmet.com wrote in message
news:mn******** *************** @spamgourmet.co m...
Or now that I think about it some more, what about renaming "mydir" to
some different name ("mydir-temp") and then renaming that to "MYDIR"?
That's certainly the way I do it...
Yes, now that I think about it. Much better.
--
Kevin Spencer
Microsoft MVP
Bit Player http://unclechutney.blogspot.com
Where there's a Will, there's a William.
"Mark Rae" <ma**@markNOSPA Mrae.comwrote in message
news:Oz******** ******@TK2MSFTN GP02.phx.gbl...
"Hans Kesting" <ne***********@ spamgourmet.com wrote in message
news:mn******** *************** @spamgourmet.co m...
>Or now that I think about it some more, what about renaming "mydir" to some different name ("mydir-temp") and then renaming that to "MYDIR"?
That's certainly the way I do it... This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: dudufigueiredo |
last post by:
I have one folder containing mp3 files, the folder is:
C:\My Shared Folder\Rubber Soul
And the files are:
01 drive my car.mp3
02 norwegian wood.mp3
03 you won't see me.mp3
04 nowhere man.mp3
..
..
|
by: Jay at SCA |
last post by:
I've been having the following issue with a windows
service I've created in vb.net (.net fw 1.1):
Basically, my service monitors a folder for the creation
of any new files of a particular type and renames them
using the "Rename(oldfilename,newfilename)" function.
Unfortunately, this function only seems to work if and
only if it is preceeded by a 'msgbox("<some text>")'.
ie. If I have the following the service sees the file
|
by: Erik Foreman |
last post by:
I am using a folderbrowserdialog object to prowse to a folder then once
in that folder I am going to have my program rename all of the files in
that folder. I know the rename funchtion but I am not sure how to get
the program to loop through each file in the folder so they all get
renamed in a certian sequence. can someone help me?
*** Sent via Developersdex http://www.developersdex.com ***
|
by: _DD |
last post by:
Is there any easy way to rename an entire project? I'd like to change
everything: folder, sln file, etc.
|
by: OdAwG |
last post by:
Hello All,
I would i check to see if a file exist and if it does exist, then rename the
file with the date and time attached to the name:
Example:
If File.Exists("\\server\share\folder\myfile.txt") Then
rename \\server\share\folder\myfile.txt
\\server\share\folder\myfile_date_time.txt
| |
by: shuaishuaiyes |
last post by:
Hello everyone...
I'm a Chinese student and my English is very poor...So excuse me if I
make grammar mistake.
I want to ask some questions about "rename". I'm a beginner, so my C
..... :)
I want to rename a batch of files..Such as I want to
rename"1.avi,2.avi" to "Prison BreakS1E1.avi,Prison BreakS1E2.avi" in
the same folder..How can I do?
|
by: aris1234 |
last post by:
how to rename file name in DB..???
this my code, but this code only save image to folder, can't rename file in DB :
<?php
//Сheck that we have a file
$folder = "../property/$spid";
if(!file_exists($folder))
|
by: keerthisreenu |
last post by:
hai to all..!!!
i am facing a problem with mov(....) in c#.
i want to rename a folder with the code.
iam using mov command.
its working.
but if i want to rename the folder to capital letters, how is it posible?
i mean i have a folder named as "sample".
i want to rename the folder to "SAMPLE".
how is it posible?
please help me.
|
by: tanichka |
last post by:
Hello you helpful folk! Please look at my script and tell me what I am doing wrong! I am cleaning the names of my music files from unnecessary symbols, and the cleaning works fine, however the perl rename function fails to do the actual renaming. I tried to rename a file in the same dir using strings instead of variables and that works!! But it seems I need to get it to work with vars as well. Can anyone give me a clue? Thanks!!
$dirname =...
|
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...
|
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...
| |
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...
|
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...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |