(paths []string, mode int64, sub bool)
| 314 | } |
| 315 | |
| 316 | func (f FileOp) ChmodRPaths(paths []string, mode int64, sub bool) error { |
| 317 | if len(paths) == 0 { |
| 318 | return nil |
| 319 | } |
| 320 | if len(paths) == 1 { |
| 321 | return f.ChmodR(paths[0], mode, sub) |
| 322 | } |
| 323 | modeStr := fmt.Sprintf("%04o", mode) |
| 324 | args := []string{modeStr} |
| 325 | if sub { |
| 326 | args = append([]string{"-R", modeStr}, paths...) |
| 327 | } else { |
| 328 | args = append(args, paths...) |
| 329 | } |
| 330 | timeout := cmdDefaultTimeout |
| 331 | if sub { |
| 332 | timeout = cmdRecursiveTimeout |
| 333 | } |
| 334 | cmdMgr := cmd.NewCommandMgr(cmd.WithTimeout(timeout)) |
| 335 | if err := cmdMgr.RunWithOptionalSudo("chmod", args...); err != nil { |
| 336 | return err |
| 337 | } |
| 338 | return nil |
| 339 | } |
| 340 | |
| 341 | func (f FileOp) Rename(oldName string, newName string) error { |
| 342 | return f.Fs.Rename(oldName, newName) |
no test coverage detected