1

Thanks for viewing my question seemed silly enough. Since directory is a kind of file, I am wandering whether it can be edit or not.I tried several editor but failed to do it. So is there any ways to make it or it is not possible at all. And if it is impossible, why? Thanks again, and best regards!

4
  • What do you want to achieve? What kind of "edit" you want to your directory?
    – P.-H. Lin
    Oct 6, 2015 at 3:26
  • I think you are taking "everything is a file" a bit literally. Just because it is a file does not mean you can or should directly edit the information. See unix.stackexchange.com/questions/18605/… as a start
    – Panther
    Oct 6, 2015 at 3:38
  • 1
    A .jpg is also a file, but can't be edited with a text editor. You are confusing "file" and "text file". A directory IS a file; it is NOT a text file.
    – Wildcard
    Oct 6, 2015 at 4:16
  • Many thanks to all of you who gives me the way of thinking~and I got it from what you mentioned above.
    – shouu
    Oct 9, 2015 at 5:49

1 Answer 1

1

You can do this in vim. e.g.

/tmp/testDirecctoryEdit>ls -l 
total 4
-rw-rw-r-- 1 a a 13 Oct  6 09:00 file
-rw-rw-r-- 1 a a  0 Oct  6 09:00 file1
-rw-rw-r-- 1 a a  0 Oct  6 09:00 file2
/tmp/testDirecctoryEdit>vim .

or vim /tmp/testDirecctoryEdit

Now it will list the files under the directory and pretty much edit the file in a way what operations are typically done on a directory
if I move my cursor to "file" and press D, the file will be deleted. Same way I can rename the files, list then by time/size using s.

And if you really want more, you can explore some of the plugins in vim, for directory related tasks. One such plugin is Nerd tree

1
  • Thank you very much ! I tried it after you posted this approach. And I begin to realize that the file doesn't equal the text file, but it is also a wonderful approach and thanks again! ~.~
    – shouu
    Oct 9, 2015 at 5:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .