问题
I was originally tracing this why does ioutil.WriteFile fails with no such file or directory
But it happens I found that the same file and it's not getting deleted
Tried
find . -maxdepth 1 -type f -name NV100708.cdr -delete
strace rm -rf NV100708.cdr
execve("/bin/rm", ["rm", "-rf", "NV100708.cdr"], 0x7ffc8bb70488 /* 109 vars */) = 0
arch_prctl(ARCH_SET_FS, 0x7f250fe88d48) = 0
set_tid_address(0x7f250fe8931c) = 363
mprotect(0x7f250fe85000, 4096, PROT_READ) = 0
mprotect(0x557d5919f000, 16384, PROT_READ) = 0
getuid() = 0
lstat("NV100708.cdr", 0x7fffc8be12c0) = -1 ENOENT (No such file or directory)
exit_group(0) = ?
also tried
rm -i -- NV100708.cdr
find . -maxdepth 1 -type f -name NV100708.cdr -print0 | xargs -0 rm -i --
But this stubborn file just does not go away. By my understanding, the filename does not have any magical character(invisible character as mention in the earlier post)
Wrote a basic script(https://pastebin.com/PMpStsB9) to print the name along with rune slices
M5V00722.cdr -- > [77 53 86 48 48 55 50 50 46 99 100 114]
M5V00722.cdr.old -- > [77 53 86 48 48 55 50 50 46 99 100 114 46 111 108 100]
M5V00725.cdr -- > [77 53 86 48 48 55 50 53 46 99 100 114]
M5V00726.cdr -- > [77 53 86 48 48 55 50 54 46 99 100 114]
M5V00727.cdr -- > [77 53 86 48 48 55 50 55 46 99 100 114]
NV100708.cdr -- > [78 86 49 48 48 55 48 56 46 99 100 114]
NV100715.cdr -- > [78 86 49 48 48 55 49 53 46 99 100 114]
NV100718.cdr -- > [78 86 49 48 48 55 49 56 46 99 100 114]
NV100719.cdr -- > [78 86 49 48 48 55 49 57 46 99 100 114]
NV100720.cdr -- > [78 86 49 48 48 55 50 48 46 99 100 114]
NV100725.cdr -- > [78 86 49 48 48 55 50 53 46 99 100 114]
NV100726.cdr -- > [78 86 49 48 48 55 50 54 46 99 100 114]
NV100727.cdr -- > [78 86 49 48 48 55 50 55 46 99 100 114]
NV110715.cdr -- > [78 86 49 49 48 55 49 53 46 99 100 114]
NV110718.cdr -- > [78 86 49 49 48 55 49 56 46 99 100 114]
NV110719.cdr -- > [78 86 49 49 48 55 49 57 46 99 100 114]
NV110720.cdr -- > [78 86 49 49 48 55 50 48 46 99 100 114]
NV110725.cdr -- > [78 86 49 49 48 55 50 53 46 99 100 114]
NV110726.cdr -- > [78 86 49 49 48 55 50 54 46 99 100 114]
NV110727.cdr -- > [78 86 49 49 48 55 50 55 46 99 100 114]
NVX00715.cdr -- > [78 86 88 48 48 55 49 53 46 99 100 114]
NVX00718.cdr -- > [78 86 88 48 48 55 49 56 46 99 100 114]
NVX00719.cdr -- > [78 86 88 48 48 55 49 57 46 99 100 114]
NVX00720.cdr -- > [78 86 88 48 48 55 50 48 46 99 100 114]
NVX00725.cdr -- > [78 86 88 48 48 55 50 53 46 99 100 114]
NVX00726.cdr -- > [78 86 88 48 48 55 50 54 46 99 100 114]
NVX00727.cdr -- > [78 86 88 48 48 55 50 55 46 99 100 114]
XFILE00181.cdr -- > [88 70 73 76 69 48 48 49 56 49 46 99 100 114]
All other files with the same permission in the same directory are getting deleted before posting just deleted the XFILE00181.cdr
file and it worked.
It would help if someone helps me understand why it is not deleting the file before actually deleting it.
If it helps the file is in Azure Mounted point.
来源:https://stackoverflow.com/questions/63131903/unable-to-delete-a-stubborn-file