sh 将文件移动到文件扩展名
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh 将文件移动到文件扩展名相关的知识,希望对你有一定的参考价值。
#!/usr/bin/env bash
# Exec
mkdir -p ./order/exec
find . -name "*.exe" -exec mv --backup=t \{\} ./order/exec \;
find . -name "*.bat" -exec mv --backup=t \{\} ./order/exec \;
find . -name "*.sh" -exec mv --backup=t \{\} ./order/exec \;
find . -name "*.deb" -exec mv --backup=t \{\} ./order/exec \;
find . -name "*.bin" -exec mv --backup=t \{\} ./order/exec \;
# Images
mkdir -p ./order/img
find . -name "*.gif" -exec mv --backup=t \{\} ./order/img \;
find . -name "*.svg" -exec mv --backup=t \{\} ./order/img \;
find . -name "*.eps" -exec mv --backup=t \{\} ./order/img \;
mkdir -p ./order/img/jpg
find . -name "*.jpg" -exec mv --backup=t \{\} ./order/img/jpg \;
find . -name "*.JPG" -exec mv --backup=t \{\} ./order/img/jpg \;
find . -name "*.jpeg" -exec mv --backup=t \{\} ./order/img/jpg \;
mkdir -p ./order/img/png
find . -name "*.png" -exec mv --backup=t \{\} ./order/img/png \;
find . -name "*.PNG" -exec mv --backup=t \{\} ./order/img/png \;
mkdir -p ./order/img/tiff
find . -name "*.tiff" -exec mv --backup=t \{\} ./order/img/tiff \;
find . -name "*.tif" -exec mv --backup=t \{\} ./order/img/tiff \;
find . -name "*.TIF" -exec mv --backup=t \{\} ./order/img/tiff \;
# Multimedia
mkdir -p ./order/multimedia
find . -name "*.mpeg" -exec mv --backup=t \{\} ./order/multimedia \;
find . -name "*.m4a" -exec mv --backup=t \{\} ./order/multimedia \;
find . -name "*.mp3" -exec mv --backup=t \{\} ./order/multimedia \;
find . -name "*.mp4" -exec mv --backup=t \{\} ./order/multimedia \;
# Docs
mkdir -p ./order/docs
find . -name "*.doc" -exec mv --backup=t \{\} ./order/docs \;
find . -name "*.docx" -exec mv --backup=t \{\} ./order/docs \;
find . -name "*.xls" -exec mv --backup=t \{\} ./order/docs \;
find . -name "*.xlsx" -exec mv --backup=t \{\} ./order/docs \;
find . -name "*.pptx" -exec mv --backup=t \{\} ./order/docs \;
# Pdf
mkdir -p ./order/pdf
find . -name "*.pdf" -exec mv --backup=t \{\} ./order/pdf \;
find . -name "*.PDF" -exec mv --backup=t \{\} ./order/pdf \;
# txt
mkdir -p ./order/txt
find . -name "*.csv" -exec mv --backup=t \{\} ./order/txt \;
find . -name "*.txt" -exec mv --backup=t \{\} ./order/txt \;
find . -name "*.log" -exec mv --backup=t \{\} ./order/txt \;
find . -name "*.xml" -exec mv --backup=t \{\} ./order/txt \;
# Adobe
mkdir -p ./order/adobe
find . -name "*.psd" -exec mv --backup=t \{\} ./order/adobe \;
find . -name "*.ai" -exec mv --backup=t \{\} ./order/adobe \;
# Compress
mkdir -p ./order/compress
find . -name "*.zip" -exec mv --backup=t \{\} ./order/compress \;
find . -name "*.gz" -exec mv --backup=t \{\} ./order/compress \;
find . -name "*.rar" -exec mv --backup=t \{\} ./order/compress \;
# Backup
mkdir -p ./order/backup
find . -name "*.bk" -exec mv --backup=t \{\} ./order/backup \;
find . -name "*.bak" -exec mv --backup=t \{\} ./order/backup \;
find . -name "*.backup" -exec mv --backup=t \{\} ./order/backup \;
# More
mkdir -p ./order/more
find . -name "*.dwg" -exec mv --backup=t \{\} ./order/more \;
# Web
mkdir -p ./order/web
find . -name "*.html" -exec mv --backup=t \{\} ./order/web \;
find . -name "*.css" -exec mv --backup=t \{\} ./order/web \;
find . -name "*.js" -exec mv --backup=t \{\} ./order/web \;
find . -name "*.less" -exec mv --backup=t \{\} ./order/web \;
find . -name "*.ico" -exec mv --backup=t \{\} ./order/web \;
find . -name "*.json" -exec mv --backup=t \{\} ./order/web \;
find . -name "*.sqlite" -exec mv --backup=t \{\} ./order/web \;
find . -iname '._*' -exec rm -rf {} \;
find . -name '*.DS_Store' -type f -delete
find . -name "Thumbs.*" -type f -delete
find . -type d -empty -delete
以上是关于sh 将文件移动到文件扩展名的主要内容,如果未能解决你的问题,请参考以下文章
sh 使用rclone将文件夹/文件从本地移动到Google云端硬盘