Can't delete a file ....
Hi All,
I've been searching on Google for a couple of hours and have not found anything that works :cry: I'm trying to delete a file on FC6 using WinSCP/PuTTY. When i use WinSCP to list the image directory I get: Unexpected directory listing line '?--------- ? ? ? ? ? a56896.jpg'. '?' is not a valid integer value When i list it using the command line, it shows question marks: --wxrwxr-x 1 root root 4875 Nov 30 2006 a56884.jpg ?--------- ? ? ? ? ? a56896.jpg If i try and delete the file using the command line i get: rm: cannot lstat `a56896.jpg': Unknown error 990 Hope someone can help? :) Cheers, Jim |
Try making a temporary directory one level above the one you are in. Move all the files in the directory you are in except for the one with the problem to the temp directory. Change directories up one level and rm -rf the directory you were in.
Code:
mkdir ../temp-directory-123 HTH Forrest |
Hi Forrest,
Thanks for the info, one question, the directory has over 26k images, how do i move all the files except for the few with the problems? Cheers, Jim |
In the directory run "ls |wc -l" This will tell you the number of files and subdirectories in that directory. Then run "ls |grep \?|wc -l" this should tell you the number of files w/ corrupted names. There is a possibility that the questions marks aren't actually question marks and won't appear in the grep. If they don't, stop here and let me know. Next run "ls |grep -v \? |wc -l" this should tell you the number of files that DON'T have corrupted names. If the number of corrupted names looks about right, and the number of corrupted plus the number of uncorrupted is equal to the total, then:
Code:
% tcsh Now, check the directory and make sure you haven't left any files that should not be deleted. If satisfied, continue with "cd .." in my previous post. HTH Forrest |
Hi Forrest,
This is what i get: ls |wc -l 36231 ls |grep \?|wc -l 0 You said stop if i have any problems :D Cheers, Jim |
Hi Jim,
Try removing the file using: rm -rf ./'filename' or rm -rf -- 'filename' indiancosmonaut |
Hi indiancosmonaut,
When i try both commands i get: rm: cannot lstat `a56896.jpg': Unknown error 990 Cheers. |
Hopefully the directory is corrupt and not the filesystem. ( To the kernel, a directory is just a file )
If you use "ls -i" is the inode of the file listed? You could use find to select the file with that inode and then delete it. Code:
find . -maxdepth 1 -inum <inode number> -okdir rm -f '{}' \; |
Hi jschiwal,
Thanks 4 posting, The images that are fine have a long number next to them, but the image that is corrupt has a 0 next to it, is that bad news? Cheers, Jim |
Sorry, that should have been "ls -l" not "ls" in the commands above. And the foreach also needs to be changed to:
Code:
%tcsh HTH Forrest |
Quote:
|
Hi Guys,
I've found the same problem in one of my backup folders :( When i do 'ls -l' it says total 0, then i get a list of stuff like ablow and the file names have a red background ... ?--------- ? ? ? ? ? a?2440.jpg ?--------- ? ? ? ? ? a?2489.jpg ?--------- ? ? ? ? ? a?2526.jpg ?--------- ? ? ? ? ? a?2571.jpg ?--------- ? ? ? ? ? a?2625.jpg Once again thanks for all your help :D Cheers, Jim |
How do you do your backups? Must be some sort of low-level backup to duplicate the corrupted directory...
|
well when i say backups ... i mean backup :( only done one up to now (i just dump the database every day and download it). We moved from our old host about a month or so ago ...
In WinSCP i select the folder, right click and Tar/Gzip ... so im starting to think if the problem started on the other server, or maybe during the transfer. I only discovered this problem when i was trying to do a backup. Cheers. |
All times are GMT -5. The time now is 05:42 AM. |