开发者

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

开发者 https://www.devze.com 2023-02-07 23:13 出处:网络
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

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-----开发者_如何学JAVA

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


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.


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.


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?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号