How to change a file that used to be a directory back to directory on linux?

微笑、不失礼 提交于 2020-01-05 13:08:42

问题


I was playing around with Apache VFS API to move files back and forth between my local machine and remote linux host over sftp and it converted some directories to files somehow on my linux host from drw-r----- to -rw-r-----

Does anyone know how to convert it back to a directory?


回答1:


You have to remove the file and then make a directory containing the file's original name.

The problem is not that a directory was converted to a file, the problem was that a directory was deleted, and a file of the same name was created.




回答2:


Remove and create again:

rm foo
mkdir foo

Anyway if former directory is now file it is empty. In this case it is not a problem to re-create it.




回答3:


You can't convert a file to a directory. You can remove the file and create a directory with the same name.

Is there something strange with the changed directories?



来源:https://stackoverflow.com/questions/4855373/how-to-change-a-file-that-used-to-be-a-directory-back-to-directory-on-linux

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!