• Home
  • About
  • Archives
Skip to content

Pario TechnoBlob

A chronological documentation test project, nothing serious, really!

  • Home
  • About
  • Archives

Copy files using tar

Posted on 23. January 200929. January 2009 by Hans-Henry Jakobsen

This is a oneliner to copy files from current directory to another target directory using tar, preserving file attributes, dates etc.

#!/bin/sh

fromdir=/path/from
todir=/path/to/target

echo "cd $fromdir; tar cf - . | (cd $todir; tar xpf -)"

cd $fromdir; tar cf - . | (cd $todir; tar xpf -)

Share this:

  • Twitter
  • Facebook
Posted in: Linux, ScriptingTagged: bash, copy, tar.

Post navigation

Previous: IP address change notifier script
Next: Enable secure / https SSL login on mediaWiki 1.13.3
Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy

Search

Apache apt-get awk backup basename bash CentOS convert csv Database dd Debian esxi5 Etch EXIF Fedora find Gentoo grep howto html imagemagick iptables iso jhead JPG mount MySQL Nikon nmap perl PHP Postfix RedHat rename rhel5 sed sftp SMTP sort ssh Ubuntu VMware Wordpress Zimbra

  • Backup
  • Linux
  • Misc
  • Network
  • Photo etc
  • Scripting
  • Security
  • Virtualization
  • Web
  • Windows
Resume X WordPress Theme by Wp Theme Space