Score:0

rename command fails saying file exists when it doesn't

tv flag

I needed to change the case of filename extensions and used this command in a directory of 26 WAV files: rename 's/.WAV/.wav/' *.WAV It worked successfully. I then changed to a different directory where I needed to repeat the process. But the command failed with errors that the lower case named files already existed. The ls or even the ls -a command proved the files did NOT exist. Only the upper case files were there.

I'm using Ubuntu 22.04. Is there some explanation or is this a bug?

New edit: I just created a test directory under /opt and created 3 ".WAV" filenames. My original rename command above worked fine. ubfan1 may have identified a likely problem asking about a FAT file system since my original work was done on files on a usb stick and the files were created originally using Windows.

Conclusion: The rename command may not work directly on files on a usb stick. But those files can be copied to a working directory on your linux filesystem where the command works perfectly.

Thanks to you who responded. This was an example of how helpful "ask ubuntu" can be: responses within hours, presumably from around the world.

hr flag
Since `.WAV` on the LHS of a perl substitution will match any single character followed by `WAV` anywhere in the name, it's possible that the name conflict is not where you think it is - please [edit] your question to include a complete verbatim example of the exact command you used and its error message.
sudodus avatar
jp flag
Please list the files in the directory, where you have problems: Edit the original question and render the command and its output as `code`.
cc flag
Was your different directory on a different (case insensitive) filesystem like FAT?
pLumo avatar
in flag
Anyways, .... try `'s/\.WAV$/.wav/'`
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.