(Elementary user)
Could anyone please assist with the following ....
I have written a very simple script that evaluates how many files are in a directory.
The problem is that sometimes the files are in sub-folders and these also end up been 'counted' as files.
I suppose it is because I am using the ls -m flag which will produce a list for example:
File01.pdf,File02.pdf,MY_SUBFOLDER,
Is it possible to change my script so that it looks for files recursively in the path and ignores the directories (numberoffiles)?
Best regards
---------------------------------------------------------------
#!/bin/sh
#
#
numberoffiles=`ls -m /path/to/my/files/`
while [ -n "$numberoffiles" ]
do
# run my programme
/usr/my/binary Test
numberoffiles=`ls -m /path/to/my/files/`
done
#
#
# END
---------------------------------------------------------------
Could anyone please assist with the following ....
I have written a very simple script that evaluates how many files are in a directory.
The problem is that sometimes the files are in sub-folders and these also end up been 'counted' as files.
I suppose it is because I am using the ls -m flag which will produce a list for example:
File01.pdf,File02.pdf,MY_SUBFOLDER,
Is it possible to change my script so that it looks for files recursively in the path and ignores the directories (numberoffiles)?
Best regards
---------------------------------------------------------------
#!/bin/sh
#
#
numberoffiles=`ls -m /path/to/my/files/`
while [ -n "$numberoffiles" ]
do
# run my programme
/usr/my/binary Test
numberoffiles=`ls -m /path/to/my/files/`
done
#
#
# END
---------------------------------------------------------------