상황
./에 train, test, val이 있는데 audio가 images안에 모두 들어가 있다.
이런 경우 audio만 따로 분리하고 싶은데 images의 폴더구조를 그대로 유지하면서 복사하는 방법은?
find ./ -name "*.wav" -type f -print | cpio -pdm ../audios
- find . will start in the current directory ie. dir1
- -mindepth 2 will ignore the contents of the current directory ie. dir1 and include the contents of its sub-directories.
- -type f -name "*.py" -print will include only files with .py extension.
- cpio -pdm will copy. -p creates a list of files, -d creates directories as needed and -m sets the correct modification times on directories.
- ../dir2 will create a directory ( if it does not exist ) named dir2 one level up next to dir1 and copy everything to it.