小编IMT*_*Man的帖子

在 Linux 中使用 davfs 挂载 SharePoint 文档库

我能够安装davfs2,我什至可以使用它装载 SharePoint 文档库,但是当我尝试在装载上执行任何操作时,我收到错误消息。

我可以挂载文档库:

root@host:/# mount -t davfs "http://sharepoint/Shared Documents" /mnt/sp
Please enter the username to authenticate with server
http://sp/Site Stuff or hit enter for none.
  Username: username
Please enter the password to authenticate user nacho with server
http://sp/Site Stuff or hit enter for none.
  Password:  
Run Code Online (Sandbox Code Playgroud)

我可以 CD 到它,我可以看到它从那里安装:

root@host:/# cd /mnt/sp
root@host:/mnt/sp# ls
Forms  lost+found  home.html
Run Code Online (Sandbox Code Playgroud)

但是,当我尝试创建文件或执行任何操作时,出现错误:

root@host:/mnt/sp# touch a
touch: setting times of ‘a’: No such file or directory

root@host:/mnt/sp# date > hi.txt
bash: hi.txt: Invalid …
Run Code Online (Sandbox Code Playgroud)

linux webdav davfs2

6
推荐指数
1
解决办法
1万
查看次数

递归清理文件夹中没有文件的所有文件夹和子文件夹

我有一个文件夹,文件夹中的文件夹中有很多文件夹等等......有些文件夹有文件,有些没有。我想通过查找所有没有文件的目录并删除它们来清理主文件夹。一个例子可能更有意义:

所以如果我从这个开始:

  • mainFolder
    • folder1
      • folder1 (空的)
      • folder2
        • file.txt
      • folder3 (空的)
    • folder2
      • folder1 (空的)
      • folder2 (空的)
      • folder3
        • folder1
          • folder1 (空的)
    • folder3
      • folder1
        • file.txt

我应该以这样的方式结束:

  • mainFolder
    • folder1
      • folder2
        • file.txt
    • folder3
      • folder1
        • file.txt

所以:

  • /mainFolder/folder1/folder1 被删除,因为它没有文件
  • /mainFolder/folder1/folder3 被删除,因为它没有文件
  • /mainFolder/folder2 被删除是因为它没有文件,甚至所有的子文件夹都是空的

我希望这是有道理的...

我唯一的想法是从mainFolder每个子文件夹开始并递归向下移动,删除空的子文件夹。

bash directory files delete

3
推荐指数
1
解决办法
2875
查看次数

标签 统计

bash ×1

davfs2 ×1

delete ×1

directory ×1

files ×1

linux ×1

webdav ×1