Extract filename from file result in ansible

Question:

I’m trying to use the result of Ansible find command, which return list of files it find on a specific folder, the problem is, when I iterate over the result, I do not have the file names, I only have their full paths (including the name), is there an easy way to use the result item below to provide the file_name in the second command as shown below?

Answer:

basename filter?

There are also dirname, realpath, relpath filters.

Leave a Reply