Command to list only files in a directory

Dev777

Active member
I'm looking for a command to only list files in a directory using shell. I've tried ls -f and many others but they include directories too
 

Endercraft

Moderator (& bug finder :D)
This isn't really related to MacroDroid.
You can search online and find this : find . -maxdepth 1 -type f
 

Dev777

Active member
Thanks alot. It works. Is there a way to make it show only files which aren't of a specific extension? Like show only files which aren't jpg.
Edit.
find . -not -name "*.jpg" -maxdepth 1 -type f
 
Last edited:

Dimlos

Well-known member
It works in my environment, but there are other commands that work, so it should not be a problem.
 

Attachments

  • directory.jpg
    directory.jpg
    492.9 KB · Views: 3
  • macro.jpg
    macro.jpg
    345.4 KB · Views: 3
  • script.jpg
    script.jpg
    409.1 KB · Views: 3

Dev777

Active member
Getting this error with Termux-tasker. I followed your tutorial in this thread.


Could you know why this is happening?
 

Attachments

  • Screenshot_2023-10-19-18-46-48-478_com.arlosoft.macrodroid_1.jpg
    Screenshot_2023-10-19-18-46-48-478_com.arlosoft.macrodroid_1.jpg
    200.4 KB · Views: 8

Dimlos

Well-known member
Could you know why this is happening?
I can see that an error is occurring, but I don't know the details of the script or settings.
Please attach the macro file if possible.
I will try to verify if the error occurs in my environment.
 

Dimlos

Well-known member
Try changing Arguments as follows.
-s 'ls -F | grep -v / | grep -v .jpg'
 

Attachments

  • termux.tasker.jpg
    termux.tasker.jpg
    370.3 KB · Views: 2
Top