User Tools

Site Tools


ubuntu:file:copy_files_to_different_directory

This is an old revision of the document!


Ubuntu - File - Copy files to different directory

#!/bin/bash                                                                                                                                                                                                 
 
for filename in *; do
  if [[ -f "$filename" ]]; then
    base=${filename%.*}
    ext=${filename#$base.}
    mkdir -p "${ext}"
    mv "$filename" "${ext}"
  fi
done

find . -name \*.txt -exec cp {} someDirectory \;

ubuntu/file/copy_files_to_different_directory.1652201559.txt.gz ยท Last modified: 2022/05/10 16:52 by peter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki