how many different ways we can remove the file from a directory structure.
Except the rm command can we remove the file from the directory structure ?
I've doubt regarding can we redirect the desire directory structure to the /dev/null or /dev/zero so that all the content is as null.. how can i achieve this things ? |
What problem are you trying to solve?
You can't re-direct a directory structure to /dev/null. You re-direct DATA (to any number of places, including /dev/null) |
there is an another command called "unlink" . but it can only delete files not directories .
|
Given thaqt directories are just special files, I suppose you could just edit them with debugfs or the like, however this is a really bad idea in all but the most desperate of circumstances (e.g. trying to recover a seriously hosed filesystem), and it should never, ever be done on a mounted filesystem.
Like pixellany asked, what exactly are you trying to do that you can't use rm? |
The thing is that there is some million files in a directory , my i am trying to remove all these but by using rm it takes lots of time .
so can it possible in the fraction of second to this?? |
The slow performance is not the rm(1) command, it is the updating of the directory itself, which is a slow operation. Changes have to be written to the disk upon each unlink(2) operation.
|
try this
cd / to folder ( cd /home/me/tempfiles1 ) rm -I * see : "rm --help" or "man rm" there also is shred -n 1 -u * but this will take a while |
The chosen filesystem has a big impact on this. Some filesystems are faster than others at deleting files. You can't just redirect a tree to null nor anything like that. The files need to be unlinked from the filesystem one by one, directories can't be deleted unless the only files inside them are . and ..
rm is as fast as it can be, if the file list is really really long, you can use xargs to work around it. |
Quote:
yes, shred is more secure to use for the remove the file system. Thank you |
All times are GMT -5. The time now is 06:11 PM. |