[][src]Function rfm::touch

pub fn touch(file_paths: &Vec<&PathBuf>) -> Result<()>

Creates a file/files in the passed path. file_paths - takes a list of paths of what you want to create.

Errors

This function will return an error in the following situations, but is not limited to just these case:

  • Param file_paths contains file or directory does not exist.
  • Param file_paths contains file or directory with invalid name.
  • The current process does not have the permission to access to input params.

Example

ⓘThis example is not tested
 extern crate rfm;
 use rfm::touch;

 let file_1 = std::path::Path::new("./file-1.txt").to_path_buf();
 let file_2 = std::path::Path::new("./file-2.txt").to_path_buf();
 let files: Vec<&std::path::PathBuf> = vec![&file_1, &file_2];

 touch(&files)?;