The Shell (Bash) programming instance obtains all the file names (including folders) in a folder. Many of them do not understand it, so they record all the files they actually use, I hope the experts will give you more valuable comments. Thank you www.2cto.com [plain] #! /Bin/sh #============= get the file name ============= Folder_A = "/home/youname/ shell/gotfilename/bin "for file_a in $ {Folder_A }/*; do temp_file = 'basename $ file_a 'echo $ temp_file done can also be redirected to a file to be output to [plain] #! /Bin/sh #============= get the file name ============= Folder_A = "/home/Neo/ shell/gotfilename/bin "Output_file =" output.txt "# Use this command to clear the original output file, feeling: this symbol is very useful. It is www.2cto.com:> $ Output_file for file_a in $ {Folder_A}/* To learn more about shell }/*; do temp_file = 'basename $ file_a 'echo $ temp_file> $ Output_file done Update (20130222) -------- added interactivity [html] #! /Bin/sh #============= get the file name ============= echo-e "Enter read folder path \ n current path $ {PWD} "read InputDir echo" Your Input Folder path is $ {InputDir} "echo-e" Please input the data you want to output saved file path n current path $ {PWD} "read OutputFile echo" output saved file path $ {OutputFile} ":> $ OutputFile # Clear OutputFile # loop read folder name for file_a in $ {InputDir }/*; do temp_file = 'basename $ file_a 'echo $ temp_file> $ OutputFile done seems to be better achieved by using command lines in combination with regular expressions