Disk Usage – How to Check Disk Usage in FTP

disk-usageftp

Is there a way to sum up the disk usage of a certain directory while in ftp?
I was trying to create a script that will check what is the disk usage of the current directory and prints out the free space for the home directory.

Example:

ftp> cd /home/directory/
drw-rw-rw-   1 user     group           0 Nov 16 /directory
drw-rw-rw-   1 user     group           0 Nov 16 next/directory
drw-rw-rw-   1 user     group           0 Nov 16 next/next/directory

For some reason, I can't see any size for directories. But inside them were files that I need to check the usage, so I have to get something like this:

total disk usage for /home/directory = "some count"
total disk usage for /next/directory = "some count"
total disk usage for /../directory = "some count"

Best Answer

I suggest you to use curlftpfs to mount your FTP repository on your filesystem. Then use the traditional du -shc . command in the folder you want to know the disk usage.

Related Question