Q. I've backup created using rsync command stored at /disk2/home/tom/ directory. Accidentally, I had deleted files from /home/tom directory. I'd like to restore all file names starting with alpha numeric characters from /disk2/home/tom/ to /home/tom. How do I restore selected files in a batch mode?
A. You can simply use old good find command to copy all files in a batch mode:
$ cd $HOME
$ find /disk2/home/tom/ -maxdepth 1 -type f -iname '[a-z|0-9]*' -exec /bin/cp -v {} . \;
Where,
- /disk2/home/tom/ : Source directory
- -maxdepth 1 : Descend at most levels of directories below the command line arguments i.e. only copy files from /disk2/home/tom/ directory
- -type f : Only files no directories
- -iname '[a-z|0-9]*' : Case insensitive file copy pattern
- -exec /bin/cp -v {} . \; : Execute cp command to copy each file to your $HOME directory
You should follow me on twitter here or grab rss feed to keep track of new changes.
Featured Articles:
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012

- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop



![Unix Copy Command Examples [ cp command ]](http://s13.cyberciti.org/images/shared/rp/3/11.jpg)


![Linux: HowTo Copy a Folder [ Command Line Option ]](http://s13.cyberciti.org/images/shared/rp/3/6.jpg)






{ 0 comments… add one now }