ubuntu:file:copy_files_to_different_directory
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
ubuntu:file:copy_files_to_different_directory [2022/05/10 19:32] – peter | ubuntu:file:copy_files_to_different_directory [2022/06/13 10:16] (current) – removed peter | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Ubuntu - File - Copy files to different directory ====== | ||
- | |||
- | <code bash> | ||
- | # | ||
- | |||
- | for filename in *; do | ||
- | if [[ -f " | ||
- | base=${filename%.*} | ||
- | ext=${filename# | ||
- | mkdir -p " | ||
- | mv " | ||
- | fi | ||
- | done | ||
- | </ | ||
- | |||
- | ---- | ||
- | |||
- | ===== Copy all files by extension to single directory ===== | ||
- | |||
- | <code bash> | ||
- | find . -name \*.txt -exec cp {} someDirectory \; | ||
- | </ | ||
- | |||
- | ---- | ||
ubuntu/file/copy_files_to_different_directory.1652211154.txt.gz · Last modified: 2022/05/10 19:32 by peter