Is there a way to count how many files/folders exist on the system?
Even better if i could get the list into a csv file?
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.
Sign up to join this communityIs there a way to count how many files/folders exist on the system?
Even better if i could get the list into a csv file?
The following command will output how many files and folders are present under /
on your system.
echo `find / . -type d -print 2> /dev/null | wc -l` directories and `find / . -type f -print 2> /dev/null | wc -l` files are present on this system.
I don't know if my idea is the most elegant, but it works:
tree / | tail -1 > output
It will take a while until the tree will finish, but you will get a number of directories and a number of files, in your file "output".
Type in a terminal:
cd /
find -type f | wc -l
ls -Rtl / | grep -v ^$ | wc -l
This will list all the dirs and files on the system.
The another good way to do this is to use find.
find / -type f | wc -l
What list you want to take into CSV file?