Hello ya'll,
I stumbled over here looking for some help with Bash shell scripts..
See, the problem was I needed to copy a data DVD into (onto?) the system file space. Since this is a virtual machine, copying a DVD takes a very long time, the drive gets hot, starts dispensing error codes instead of data bits, and I abort the copy process somewhere in the middle.

Looking at the destination directory I can see where the copy process stopped, but I couldn't figure out how to restart it at that point.

I've always had trouble with abstract symbols and need a concrete example to work on, so I'll post what worked for me. Perhaps it will be the hint you are looking for.

for x in m n o p q r s t
cp -Rv "/Src_dir/"$x destination_dir

Another example:

for x in etc home data usr/local usr/share
cp -Rv /$x /system/backup

would copy those directories, and everything 'underneath to the system backup directory
Ok, so I don't really know why the drive spits out errors, but the copy command often fails to copy the entire dvd. Being able to restart, or copy only a portion of the dvd file structure was what I needed to do.

PIMF as is Google

> cp -Rv "/Src_dir/"$x destination_dir
As a cheap and easy work-around, how about

cp -Rv "/Src_dir/"$x destination_dir
sleep 120

That is, between each top-level directory, sleep for a couple of minutes to allow things to cool down a bit.

re: sleep 120

Thanks for the tip

I have no way to tell if it was heat related, or something else. Copying those files off of the DVD was taking so long I considered abandoning the project completely. But once I had a way to resume an interrupted copy, I soldier on.

It seems that every time you solve one problem, 6 more appear.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.