LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Kernel (https://www.linuxquestions.org/questions/linux-kernel-70/)
-   -   Dir with files has changed to a file (https://www.linuxquestions.org/questions/linux-kernel-70/dir-with-files-has-changed-to-a-file-929407/)

monag 02-15-2012 01:14 AM

Dir with files has changed to a file
 
Hello,
I was using a directory with some files in it. I do not remember exactly what I did...I cannot even see a trace of it in the bash history...I think I may have used the mv command wrongly.

Looking at its size I am pretty sure its a directory. But I do not know how to change it back to a dir..
I have been on the forums and on various sites but I dont see a solution to this.
I think using chmod 0777 (a correct value ...the above is wrong ) may work...However I dont know how to set the d attribute to this file now.

Can someone suggest what to do...Will appreciate this very much as this directory contains some important files..

Regards

malekmustaq 02-15-2012 03:01 AM

If chmod cannot solve fsck can fix that. Probably the sticky bit is altered at the swap.

If the directory is in a mounted volume you unmount the volume first and run
Quote:

"fsck -a /dev/partition_of_volume"
If the file in the system drive/partition you will need to shutdown and boot into a live cd or any linux repair cd and there you can issue the same command against the system partition:

Quote:

fsck -a /dev/sda(whatever, whichever)
Hope that helps.

mm

monag 02-16-2012 02:42 AM

Thanks for your reply.
I will try that out...but I dont think I used the right command for chmod.
What is the command for chmod to set the attribute for the dir.

Is it chmod 0777 filename
or .....
I would like to first try the right chmod command before trying to do and fsck and unmounting volumes which I am not expert at...However if there is no alternative I will have to try your suggestion. Thanks very much for it..
Is there a flaw in the mv command....Because I think it happened when I was using the mv commands..
Thanks in advance for your suggestions/tips/replies.

monag 02-23-2012 02:50 AM

Would appreciate if someone can give me a hint of what are the correct values to be given to the chmod command ...I know how to use the chmod command but dont know what is the sticky bit to be sit for a dir...I have looked up online but dont seem to be getting an answer to this simple issue....Please suggest/help

EDDY1 02-23-2012 03:13 AM

When you think you made a mistake, atleast in my case, I go back to my terminal & press the arrow key up & review all of the commands I entered.
Or you can look at your bash history, although it will not show those issued as root.
I often just su or open root terminal & scroll to see what I did as root
It would help if you to;d us the name of the directory in question.


All times are GMT -5. The time now is 03:52 PM.