I started copying a (large) file inside a python script with copyfile
from shutil and I had to interrupt the transfer. Now I notice that I cannot delete the file
The file that I am trying to delete is shown below (i.e. it appears to exist)
ngs@bngs05b:/path/to/dir/210305_M05113_0148_000000000-J6HHR/Data> ll
total 1
-rwxrwx--- 1 user lgen 99542099 6. Mai 11:42 LHLA-MS5387-MJ-S-10_S20_L001_R2_001.fastq.gz
If I then try to remove it with rm
ngs@bngs05b:/path/to/dir/210305_M05113_0148_000000000-J6HHR/Data> rm LHLA-MS5387-MJ-S-10_S20_L001_R2_001.fastq.gz
rm: cannot remove 'LHLA-MS5387-MJ-S-10_S20_L001_R2_001.fastq.gz': No such file or directory
which is a very strange behaviour in my opinion.
I tried a few solutions as described here (e.g. ls --escape
, ls -1b
), but none of them work.
I also tried to see if that file was opened somewhere, though the output of lsof +D
does not output anything useful I guess:
ngs@bngs05b:/path/to/dir/210305_M05113_0148_000000000-J6HHR/Data> lsof +D .
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
bash 44509 ngs cwd DIR 0,37 0 5429445751479423221 .
lsof 45768 ngs cwd DIR 0,37 0 5429445751479423221 .
lsof 45769 ngs cwd DIR 0,37 0 5429445751479423221 .
I first thought that the problem had something to do that the copied file was corrupt/ incomplete, though I don't think this is the case as I checked that the size of the file in the original location is the same of the file that I am trying to delete.
Does anyone know how can I get rid of this file?
ls LHLA-MS5387-MJ-S-10_S20_L001_R2_001.fastq.gz
give an error? and what doesls LH
show when you use {tab} to complete the file? any extra characters? – Rinzwind May 06 '21 at 18:30