高級打雜的每一天

總網頁檢視次數

星期五, 12月 13, 2019

How to rename multiple files with linux script

To rename all files starting with detail and replace it with test


for f in detail* ; do mv "${f}" "${f/detail/test}"; done
 
 
(for j in *.bak; do mv -v -- "$j" "${j%.bak}.txt"; done)

Before

detail-1.txt
detail-2.txt

After

test-1.txt
test-2.txt

發佈者: ultra2widescsi 於 11:25

沒有留言:

發佈留言

較新的文章 較舊的文章 首頁
訂閱: 發佈留言 (Atom)

網頁

  • 首頁
  • 我。

關於我

ultra2widescsi
查看我的完整個人檔案

網誌封存

  • ►  2021 (2)
    • ►  3月 (1)
    • ►  1月 (1)
  • ►  2020 (12)
    • ►  9月 (1)
    • ►  8月 (1)
    • ►  7月 (3)
    • ►  5月 (1)
    • ►  3月 (5)
    • ►  1月 (1)
  • ▼  2019 (9)
    • ▼  12月 (2)
      • How to sftp files automatically
      • How to rename multiple files with linux script
    • ►  11月 (2)
    • ►  10月 (5)
  • ►  2013 (4)
    • ►  8月 (1)
    • ►  4月 (1)
    • ►  3月 (2)
  • ►  2012 (1)
    • ►  2月 (1)
  • ►  2011 (186)
    • ►  12月 (1)
    • ►  11月 (8)
    • ►  10月 (9)
    • ►  9月 (20)
    • ►  8月 (21)
    • ►  7月 (17)
    • ►  6月 (21)
    • ►  5月 (18)
    • ►  4月 (16)
    • ►  3月 (25)
    • ►  2月 (12)
    • ►  1月 (18)
  • ►  2010 (186)
    • ►  12月 (21)
    • ►  11月 (22)
    • ►  10月 (21)
    • ►  9月 (15)
    • ►  8月 (24)
    • ►  7月 (19)
    • ►  6月 (20)
    • ►  5月 (21)
    • ►  4月 (17)
    • ►  3月 (2)
    • ►  1月 (4)
  • ►  2009 (7)
    • ►  8月 (7)
  • ►  2007 (6)
    • ►  8月 (1)
    • ►  3月 (5)
「圖片視窗」主題. 由 Blogger 提供.