Can we able to rename the files without file extensions?

I did tried the following setup, But I get the filename ended with "." may be because the same folder name as file exists.

Here is my current workflow. You can see in the image that in the final step, filename "dc." That's a html file.

enter image description here

  • did you try with using .html instead of html as find query ?
    – anki
    May 11, 2020 at 4:18
  • Suresh Kumar Gondi, I've edited your question to cover only one issue. If you have another issue, then please post another question. This site works best with one question per question. May 11, 2020 at 4:29
  • @ankii I did tried find, I have too many files in folder and sub-folder. If they are in same folder find can certainly help. May 11, 2020 at 5:46

1 Answer 1


If a folder/directory of the same base name of the file name does not exist at the same level as the file then it can be done, otherwise you cannot remove .html from the file name at the same level.

To remove the extension and the . you need to use:

  • Find: .html in fullname

If the fully qualified pathname contains .html in other then the actual file name, then you'll have to use a Run Shell Script action instead of the Rename Finder Items action.

  • Run Shell Script action:

    • Shell: /bin/bash
    • Pass input: as arguments

      for f in "$@"
          [ ! -d "${f%.*}" ] || continue
          mv -n "$f" "${f%.*}"

NOTE: As coded, if folder/directory of the same base name of the file name does exist at the same level as the file then nothing will happen and the file name will be unchanged.

If you need to clean up things, that is to remove trailing . in the file names from the previous renaming, do the following in Terminal:

cd /path/to/article
find . -type f -iregex '.*\.$' | for f in *; do [ ! -d "${f%.*}" ] || continue; mv -vn "$f" "${f%.*}"; done

Same note from above applies here as well.

  • Hey mate, Thanks for the help. In the shell command, it moves .html files the files one level down. This is code I used to create the .html files find . -mindepth 2 -type f -name '*.html' -exec sh -c ' d="$(dirname "$1")"; mv "$1" "$d/../$(basename "$d").html"; rmdir "$d"; ' find-sh {} \; To understand more about my above code workflow, here is one askubuntu.com/questions/1236564/… May 11, 2020 at 5:25
  • @Suresh Kumar Gondi, Not sure what your comment has to do with the current situation as shown in your OP, there is no shell script in your OP. If my answer is not applicable to what you've shown in your OP then you need to edit it to be more clear. May 11, 2020 at 5:34
  • Oops my bad. the code I gave in the comment has workflow of renaming the files with and move one level up. And the bash code in your first line.. move the files one level down. May 11, 2020 at 5:45
  • It did, Before share.getcloudapp.com/WnuGm1ex and after share.getcloudapp.com/E0ubX6dJ (edited) May 11, 2020 at 6:05
  • @Suresh Kumar Gondi, The linked pictures in your previous comment clarifies info in your OP that wasn't totally clear and as such I've updated my answer. May 11, 2020 at 8:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .