How to list only the file names of the same type in the directory?

Haroldo Payares Salgado

I have two groups of files in the same directory *fmb and *fmx.

I want to learn how to print only the file name of fmb files, file1.fmb, file2.fmb, file3.fmb will be printed as file1, file2, file3.

cuonglm
for f in *.fmb; do printf '%s\n' "${f%.*}"; done
  • Using pattern matching *.fmb to match all files end with .fmb
  • ${f%.*} is shell syntax for Parameter Expansion, remove the smallest suffix matched pattern in $f. Here we remove the extension part .fmb.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

How to list only the file names that changed between two commits?

From Java

Batch File; List files in directory, only filenames?

From Dev

How to list only the file names in HDFS

From Dev

Inno Setup: List all file names in an directory

From Dev

How to scan directory and save only image file names to array with php?

From Dev

Read in all the files in a particular directory displays the file names in a html list

From Dev

how to remove only the duplication file under some directory ( with the same cksum )

From Dev

How to list only the file names and not its attributes in a directory( in Linux)?

From Dev

How to build a list of file names in a local directory?

From Dev

I need a batch file to generate a list with *only* file names

From Dev

List only file names in directories and subdirectories in bash

From Dev

Bash - Check directory for files against list of partial file names

From Dev

How to find file/directory names that are the same, but with different capitalization/case?

From Dev

How do I list file names on a server in a directory?

From Dev

Bash - Check directory for files against list of partial file names

From Dev

List the file permissions of only the current directory

From Dev

How to link to full size images from thumbnails? same directory, different file names

From Dev

List file names from a directory and place output in a text file

From Dev

How to zip directory with encryption for file names?

From Dev

How to copy a directory with only specified type of files?

From Dev

How is a directory a "special type of file"?

From Dev

How to execute command on list of file names in a file?

From Dev

Get list of file names in folder/directory with Excel VBA

From Dev

How to recursively list all files of desired file type in a specified directory?

From Dev

How to list all files in named directory, file type included?

From Dev

How to get the names of the last child directory in list

From Dev

Download list of directory/file names only from web server index

From Dev

iterate a directory and find only file whose names start with the certain string

From Dev

Copy a list of files with the same names but different extensions to a new directory

Related Related

  1. 1

    How to list only the file names that changed between two commits?

  2. 2

    Batch File; List files in directory, only filenames?

  3. 3

    How to list only the file names in HDFS

  4. 4

    Inno Setup: List all file names in an directory

  5. 5

    How to scan directory and save only image file names to array with php?

  6. 6

    Read in all the files in a particular directory displays the file names in a html list

  7. 7

    how to remove only the duplication file under some directory ( with the same cksum )

  8. 8

    How to list only the file names and not its attributes in a directory( in Linux)?

  9. 9

    How to build a list of file names in a local directory?

  10. 10

    I need a batch file to generate a list with *only* file names

  11. 11

    List only file names in directories and subdirectories in bash

  12. 12

    Bash - Check directory for files against list of partial file names

  13. 13

    How to find file/directory names that are the same, but with different capitalization/case?

  14. 14

    How do I list file names on a server in a directory?

  15. 15

    Bash - Check directory for files against list of partial file names

  16. 16

    List the file permissions of only the current directory

  17. 17

    How to link to full size images from thumbnails? same directory, different file names

  18. 18

    List file names from a directory and place output in a text file

  19. 19

    How to zip directory with encryption for file names?

  20. 20

    How to copy a directory with only specified type of files?

  21. 21

    How is a directory a "special type of file"?

  22. 22

    How to execute command on list of file names in a file?

  23. 23

    Get list of file names in folder/directory with Excel VBA

  24. 24

    How to recursively list all files of desired file type in a specified directory?

  25. 25

    How to list all files in named directory, file type included?

  26. 26

    How to get the names of the last child directory in list

  27. 27

    Download list of directory/file names only from web server index

  28. 28

    iterate a directory and find only file whose names start with the certain string

  29. 29

    Copy a list of files with the same names but different extensions to a new directory

HotTag

Archive