Score:0

Cannot create file that doesn't already exist

us flag

I'm trying to create a file by writing to it, and I'm being given the error that it does not exist (of course it doesn't --I'm trying to create it!)

I know about the problem where the path to the file doesn't exist (e.g. if I were to type touch /path/to/folder/file_x , and the directory /path/to/folder/ didn't exist, then this would make sense.) That's not what's happening here. I'm in the local directory where I want to create the file (no path issues).

touch file_a
touch file_b  # <-- these files are created, no problem

but for a particular filename that I had created earlier and already deleted, this breaks:

touch  file_x
touch: cannot touch 'file_x': No such file or directory

I also can't delete it:

rm file_x
rm: cannot remove 'file_x': No such file or directory

I can't delete what doesn't exist, but I also can't create it again. I don't understand how this is possible. This is on an NTFS drive, so perhaps there's a problem with Linux mounting a windows drive?

cn flag
if NTFS you need to add the mount options it has. If the system is READ ONLY you can not touch a file and can not delete it. file_a and file_b are made on the same dir as File_x at the aame moment?
muru avatar
us flag
Case sensitivity might be a play. Does `file_x` or `fiLe_x` or `FILE_X` or some other variation on case already exist?
Jabber1 avatar
us flag
@muru my apologies for writing the initial question with inconsistent case (which I can see created confusion; I've made everything consistent now). If I try to create `file_X` then that works fine, so case-sensitivity is as expected. It's just the very specific name `file_x` that seems to be "blocked" somehow --not quite deleted, but also not available.
us flag
What is the actual name of `file_x`? Perhaps windows does not allow certain file names, and NTFS follows the rules
Jabber1 avatar
us flag
The actual name is `sampleList_2023.08.29.json` (I thought abstraction would be simpler)
pLumo avatar
in flag
maybe the file is deleted but still open from another program ? Check `lsof`. Does it still persist after remount or reboot?
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.