Got an issue that I can’t seem to find a fix for and not sure how to explain it as when I have to my Linux using friend he thought I meant something else.
I need to be able to copy and paste a selection of folders and files with case insensitive overwriting (such as folder “LN” overwrites/writes into folder “ln”).
The reason for this is that I am installing mods for an old game called Morrowind and each mod includes a “Data Files” folder with various sub-folders and files. The problem here is that not people who have mad these mods use the same case when typing the folder names (i.e. some will put ./Meshes/LN/this_mesh while another will put ./meshes/Ln/this_mesh.)
This isn’t a problem with Windows as will see all the folders the same even with different case and put everything where it needs to be. However, this becomes a problem with Linux because I will end up occasionally with multiple folders where they should have been merged. (i.e. in the above example I would end up with both a Meshes and meshes folder.)
With the amount of mods I am adding to the game it becomes EXTREMELY tedious to have to manually look through every single folder and all their many sub-folders to look for possible duplications due to case differences in the folder names and then rename to merged them. However, if I don’t do this, when running the game under wine only the first folder (where such “duplicates” exist) will be seen, causing the game to not see resources, creating errors.
At the moment I am running Windows XP within OracleVM with a network shared folder. When I want to add a mod I will copy my game install to the shared folder and then I’ll extract all the mods in my virtual WinXP and then put into the shared folder to copy it back over to my wine installation.
While the above works, I would love it if I could find a way to paste files when needed with the Windows case insensitive overwriting. Does anyone know if there is a file manager that has this option (as I would prefer this over using the command line, but am fully comfortable with that too).
Thanks ahead for any help.
Craig Shaw wrote:
> Hi, Everyone.
> Got an issue that I can’t seem to find a fix for and not sure how to
> explain it as when I have to my Linux using friend he thought I meant
> something else.
> I need to be able to copy and paste a selection of folders and files
> with case insensitive overwriting (such as folder “LN” overwrites/writes
> into folder “ln”).
> Thanks ahead for any help.
I use a script in the directory required. i call it lowercase.sh
and make it exicutable and place it in ~/bin
# Changes every filename in working directory to all lowercase.
# Inspired by a script of John Dubois,
# which was translated into into Bash by Chet Ramey,
# and considerably simplified by Mendel Cooper, author of this document.
for filename in * # Traverse all files in directory.
n=`echo $fname | tr A-Z a-z` # Change name to lowercase.
if "$fname" != "$n" ] # Rename only files not already lowercase.
mv $fname $n
Please be aware that, the Redmond NTFS1 and VFAT file systems are not case-sensitive, they’re ** case-preserving **.
That means if you create a file named FileName.txt, the file system will preserve the mixed case name, but you can access the file with whatever case combination of the same letters, like FILENAME.TXT, filename.txt or fileNAME.txt. This explains why, you ** cannot ** have two files with the same spelling with only a variation of upper/lower case in the same directory (of a Redmond machine).
I have annotated the above quotation.
This means that, transferring files from a “case-preserving” file system to a CaSe-SeNsItIvE file system always quite a bit of effort which, can only be eased by the use of the power of Linux and/or UNIX® shell scripts.
My usual approach is to begin with manual methods and then begin to write custom shell scripts such as the one provided by graham. To actually check if everything has been migrated successfully, the scripts can be quite complex and, may involve the use of tools such as “Perl” or “awk”.
[HR][/HR]“Redmond” is where the Headquarters of the Gates/Ballmer Company is located.
I agree with that.
It already came to my mind that before doing the rename a test to check if the new (all lowercase) name does already exist might be imminent. Else a mv in script will delete that file.
Other tests might be needed. This is one of those questions were the solution looks obvious, but might not be so.