Edit names of files in a directory

Hi all,

I have a directory with multiple (thousnads) of files, which are named this way

ABCDEF.wo.im-1
OKRAME.ire.roi
IOJEAFO01.irt.gfg
IMNYBL05.REG.gkf

I would like to keep the part of the name (everything before the first dot in the filename).
The desired output:

ABCDEF
OKRAME
IOJEAFO01
IMNYBL05

I know I should be using `sed` for this, but I haven't used Linux for a while, some help would be appreciated.
Please feel free to assume any directory as an example "~$home/user"

Thanks all

Depending on your shell, you could do this also with Parameter Substitution.
What have you tried so far?

1 Like

Try

for FILE in *; do echo mv $FILE ${FILE%%.*}; done

Should this exceed your LINE_MAX, try

ls * | while read FILE; do  echo mv $FILE ${FILE%%.*}; done
2 Likes

I haven't tried stuff yet (cuz I am not sure how to start the command), been looking online for similar questions, found none yet. I am using a bash shell.

---------- Post updated at 10:05 AM ---------- Previous update was at 09:58 AM ----------

Yes that worked :rolleyes:, I should keep on revising what I know in Linux. Many Thanks mate :b: