Linux Shell Script For Each File in a Directory Grab the filename and execute a program

后端 未结 4 804
耶瑟儿~
耶瑟儿~ 2020-12-07 08:14

Scenario :

A folder in Linux system. I want to loop through every .xls file in a folder.

This folder typically consists of various folders, various filetypes

4条回答
  •  佛祖请我去吃肉
    2020-12-07 09:07

    Look at the find command.

    What you are looking for is something like

    find . -name "*.xls" -type f -exec program 
    

    Post edit

    find . -name "*.xls" -type f -exec xls2csv '{}' '{}'.csv;
    

    will execute xls2csv file.xls file.xls.csv

    Closer to what you want.

提交回复
热议问题