decentswati
asked on
change file to directories and vice versa
Hi,
It's funny to think or say but i have a question in my mind,
is there any way to change the files to directories or vice versa by some way.like changing the in its property of
drwxr--r-- to -rwxr--r--
if it could be please suggest
It's funny to think or say but i have a question in my mind,
is there any way to change the files to directories or vice versa by some way.like changing the in its property of
drwxr--r-- to -rwxr--r--
if it could be please suggest
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Make sure you have libext2fs on your system (ldconfig -p|grep ext2fs) It is part of the e2fsprogs collection.
After that it would be something like:
(this is pseudo-code!)
#include <ext2fs.h>
main () {
err_code = ext2fs_read_inode(fs,inode _num,&inod e)
inode.i_mode = inode.i_mode | LINUX_S_IFDIR
ext2fs_write_inode(fs,inod e_num, &inode)
}
Not even close to a working program but these are the funtions you would need to use.
Again: you most likely WILL f*ck up your complete file system! dump before you try this.
After that it would be something like:
(this is pseudo-code!)
#include <ext2fs.h>
main () {
err_code = ext2fs_read_inode(fs,inode
inode.i_mode = inode.i_mode | LINUX_S_IFDIR
ext2fs_write_inode(fs,inod
}
Not even close to a working program but these are the funtions you would need to use.
Again: you most likely WILL f*ck up your complete file system! dump before you try this.
ASKER
really I think the way is to change the property of directory file to make it a regular file.give me the suggestion so that I can try it.OfCourse there is no reason or need to do that but knowing the thing will make concepts clear.Help me.
bye
decentswati