2 questions about ditto

Hi there. I have 2 questions about the ditto command. I have a script that copies files to certain network-volumes.

1.How can I check if there is actually enough space left on the disc I copy the files to? In my case I need to check the available disc-space on the network-volume,and then compare it to the size of the file I want to copy.

2.Can I somehow check the progress of the ditto-command? Can I get a output with an estimate time remaining or something?

And a more general question: How can I unmount the network-volume?

Cheerz


iMac G3 Mac OS X (10.3.9) 500 Mhz, 768 Mb Ram, 18Mb VRAM, 120 GB HD

Posted on May 19, 2007 5:59 AM

Reply
5 replies

May 19, 2007 11:17 AM in response to mju:sick

>1.How can I check if there is actually enough space left on the disc I copy the files to?

df

df wil give you the status of any volume (or all volumes), incuding total capacity, used and available space. Use the -k, -h or -H switches to change the unit of measurement.

>2.Can I somehow check the progress of the ditto-command? Can I get a output with an estimate time remaining or something?

There's no time estimate option in ditto. The best you can do is use verbose mode (-V or -v) to print a list of files as they're copied, but that doesn't help if you're copying a single file.

How can I unmount the network-volume?

umount

<pre class=command>umount /Volumes/Share\ Name</pre>

May 20, 2007 12:19 PM in response to mju:sick

some command that only obtains the free disc-space?

The command df -lh gives the free space on all local discs, in 'human-readable' format:
df -lh

Filesystem Size Used Avail Capacity Mounted on
/dev/disk0s3 112G 65G 47G 58% /

If you wish, you could create a command to just return the actual available capacity. For example,
df -lh | xargs echo | awk '{print $11}'

47G

Cheers,
Caleb

iMac g3 400MHz

May 20, 2007 1:13 PM in response to Caleb Mattoon

This is exactly what I wanted.Thanks a lot!

Last question:
When I use the du command to get the size of 1 specific item I want to have the same result as with the created command for df ( | xargs echo | awk '{print $11}' )

Right now when I use the du command I still get the item-name afterwards, want to get rid of it (the way you did with the other info when using df) so that i can compare the free discspace with the actual size of the item in question. So after running the desired command all that should be returned is the size,nothing else.
Thanks again!

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

2 questions about ditto

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.