Copy files and directories recursively with tar

Copying a directory tree and its contents to another filesystem using

cp -pR directory /newplace

doesn't always do the job.

Using tar instead will preserve ownership, permissions, and timestamps. This neat trick allows using tar to perform a recursive copy without creating an intermediate tar file and overcoming all cp shortcomings.

To copy all of the files and subdirectories in the current working directory to the directory /target, use:

tar cf - * | ( cd /target; tar xfp -)
Average: 4.5 (2 votes)

How to Download & Save Flash Animation Files (SWF) in Firefox

There's a good chance that the animation or cartoon game you want to download was created using Flash. Use these tips for downloading Flash files from the Internet to your hard drive. You save all Flash animations from web pages, including Flash websites, Flash game, Flash Animations, Flash Tutorials, Flash Movie Trailers, Flash Advertisements, or what ever Flash files you find in the web.

If you wish to save flash files embedded in webpages to your hard-drive for offline viewing, here is how:

Average: 4.3 (3 votes)

Leopard not booting: mDNSResponder daemon stuck

Today, after upgrading one of our machines to the latest security update, the iMac G5 stopped booting. Starting the machine in Single User mode (command+S) revealed that the mDNSResponder daemon was crashing and restarting in an infinite loop.

'The Mac was stuck in a loop trying to execute mDNSResponder (which is the basis of Bonjour networking) and the system wasn't successful.

On the Apple forums nobody is able to pinpoint the problem yet, but it looks like it is a pretty common disease. If you do not need Bonjour, this is what solved it for me:

 
Average: 4.8 (5 votes)

How to rename multiple files from the shell - tips and tricks

Renaming multiple files seems to be a problem which many newcomers to shell scripting, or administration, have problems with. But once you've done it a few times the actual solutions are very simple.

There are many cases where you might have a large number of files to rename en masse, for example files which are output from a given script or tool. Or files that must be renamed to be uploaded to a web-host.

How you rename the files mostly depends on which tools you have available, and which shell you're using.

Average: 4.8 (5 votes)

printf - formatted output (man page)

PRINTF(1)                 BSD General Commands Manual                PRINTF(1)
 
 NAME
     printf -- formatted output
 
 SYNOPSIS
     printf format [arguments ...]
 
 DESCRIPTION
     The printf utility formats and prints its arguments, after the first,
     under control of the format.  The format is a character string which con-tains contains
     tains three types of objects: plain characters, which are simply copied
     to standard output, character escape sequences which are converted and
Average: 3.2 (6 votes)

How to empty a MySQL database from the shell (drop all tables)

Let’s say you need to drop all tables in a mysql database. How do you do that?

MySQL has DROP TABLE and DROP DATABASE but there is no command to drop all tables or truncate the database.

These are some ways to do it:

Average: 4.8 (5 votes)

The best way to execute PHP scripts from a cron job

Running PHP scripts within the cron environment can be tricky!

A common technique for executing PHP scripts from a cron job is to use a command line utility like curl or wget to execute and subsequently retrieve the output of the script. Using this method, the command in your cron job would look like this:

wget http://domain.tld/script.php

Average: 4.8 (6 votes)

Recipe: How to copy files and directories recursively with tar

TAR is the Unix Tape ARchive utility. It can be used to either store data on a streaming tape device like a DAT drive, or store files in what is commonly called a tarball file - somewhat like a pkzip file, only compression is optional.

Copying a directory tree and its contents to another filesystem using tar will preserve ownership, permissions, and timestamps. A neat trick allows using tar to perform a recursive copy without creating an intermediate tar file.

To copy all of the files and subdirectories in the current working directory to the directory /target, use:

Average: 4.8 (5 votes)

One of the best Lisp Tutorials around

This is one of the best Lisp tutorials around.

Thanks to Peter Siebel for such a gem. If you like it even half as much as I did, buy a dead tree copy!

Average: 4.8 (8 votes)

Why Wolfram (Mathematica) did not use Lisp

A usenet post by Kent M Pitman on comp.lang.lisp - Fri, 8 Nov 2002 23:29:04 GMT

Average: 4.9 (8 votes)
Page execution time was 227.54 ms.