I have 2 files in a directory named App on my Ubuntu mahcine. I want to remove those 2 files completely from that directory, but when I try to remove them using rm -rf, they are not deleted.

I can't even see these 2 files in the App folder in the GUI. ls al in the directory returns:

ls: cannot access Notepad_verify���,;()p_151003101035_Results_2800.rpt: No such file or directory
ls: cannot access M J_g ;w-%()�t�{,l]_120424113032_Results_2800.rpt: No such file or directory
total 24
drwxrwxrwx  2 root root 20480 Oct  7 16:19 .
drwxr-xr-x 24 root root  4096 Oct  7  2015 ..
-?????????  ? ?    ?        ?            ? M J_g ;w-%()?t?{,l]_120424113032_Results_2800.rpt
-?????????  ? ?    ?        ?            ? Notepad_verify???,;()p_151003101035_Results_2800.rpt

If I try rm -rf, then command runs successfully but the files are not deleted. They are still in the 'App' directory.

I also tried to remove the complete directory.

With rm -rf App/, I get:

rm: cannot remove ‘AppData/’: Directory not empty

And rm -rf App/* seems to run successfully but the files are still in the App folder.

I can't even display the permission or time & date details. I can't use rm, mv, or cp commands on these files.

How can I delete these files?

  • Does fsck report a clean filesystem? – Dmitry Grigoryev Oct 7 '15 at 11:34
  • fsck on which? I ran 'fsck' on my current directory where these 2 files lies. It shows me like this.: fsck from util-linux 2.20.1 e2fsck 1.42.9 (4-Feb-2014) /dev/sda8 is mounted. e2fsck: Cannot continue, aborting. Is this what you need?or something else? please let me know. – secure Oct 7 '15 at 11:45
  • What filesystem is this directory on? How is it mounted? Please edit your question and show us the output of df /path/to/App. Can you create a file and delete it? Try touch foo; rm foo in the App directory. Also, try unmounting the filesystem where this is mounted, and running fsck on it (it will be the /dev/sdX from the output of df). – terdon Oct 7 '15 at 12:09
  • Output of 'df' command: Filesystem 1K-blocks Used Available Use% Mounted on /dev/sdc1 1889800 367052 1425088 21% /media/497f78bd-93d0-4f5e-8a32-8a279bade51a YES, I can create and delete 'foo' on same(App) directory. Output of after unmount the FS, there is a '/dev/sdc1' in my case. Filesystem 1K-blocks Used Available Use% Mounted on udev 985636 12 985624 1% /dev – secure Oct 7 '15 at 12:15
  • umount /dev/sdc1then, if umount correctly fsck /dev/sdc1 accept all. remount, files should be deletable. – Archemar Oct 7 '15 at 12:57

App folder make me think about a Liberkey or such, probably not closed cleanly.

Now you have to fix the filesystem, this is the fsck (FileSystem Consistensy Check).

If disk is mounted you can't fsck

  1. unmount disk : umount /dev/sdc1 (see device busy below)

  2. check filesystem fsck -y /dev/sdc1

  3. remount disk (if this is an usb key, just unplug/replug).

In case of "cannot umount /dev/sdc1 device busy"

  • cd /tmp
  • close all other terminal/connection
  • if that still failed, you may have application using file on disk, try a reboot.

Have you tried to use find.

find -name '*.rpt' -delete

  • I ran above command and it ran successfully, but when I am doing 'ls -al' then again files are still there, don't know why they aren't removing..!! Is there any way to delete it completely. Result of 'ls -al' same as first(above in question). – secure Oct 7 '15 at 11:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.