![](/img/trans.png)
[英]Download all csv files from Subdirectories that match across differnet directories
[英]search and rename and mv all files from directories and subdirectories
我有很多文件30k directories, 21k files
在目錄和同名txt
文件的子目錄中
├── cases__in_africa
│ ├── 2020/10/01.txt
│ ├── 2020/10/02.txt
│ ├── 2020/10/03.txt
│ └── 2020/10/04.txt
├── death_in_africa
│ ├── 2020/10/01.txt
│ ├── 2020/10/02.txt
│ ├── 2020/10/03.txt
│ └── 2020/10/04.txt
2926 directories, 21646 files
我想搜索很多子目錄中的所有文件,而不是將它們重命名為其他唯一名稱以將它們移動到其他目錄。
此命令不顯示重復文件
find . -name "*.txt" -exec mv "{}" ./all \;
如果您正在尋找順序命名,您可以這樣做,假設目標目錄all
存在於您的當前目錄中。:
for file in $(find ./ -type f -name "*.txt"); do ((count++)) ; mv $file ./all/${count}.txt; done
find -name '*.txt' -exec bash -c 'mv "{}" "$RANDOM.txt"' \;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.