By using cpio command in pass through mode, files can be copied to the destination directory with the same path structure as in the source directory
find /source_path/of/files -name "<regex_of_filetype>" | cpio -pdm /destination_directory_path
Eg: To copy all files of type "*.sh" in /home/bob to /tmp/jim, keeping the source directory path of files in destination intact
find /home/bob -type f -name "*.sh" | cpio -pdm /tmp/jim
find /source_path/of/files -name "<regex_of_filetype>" | cpio -pdm /destination_directory_path
Eg: To copy all files of type "*.sh" in /home/bob to /tmp/jim, keeping the source directory path of files in destination intact
find /home/bob -type f -name "*.sh" | cpio -pdm /tmp/jim
No comments:
Post a Comment