Results 1 to 2 of 2
Hi,
I have been asked to backup all my boss' .m files (text files used by matlab). He isn't terrifically organized so they are distributed all over the drive. I ...
- 02-23-2007 #1Just Joined!
- Join Date
- Nov 2006
- Posts
- 5
backing up multiple text files
Hi,
I have been asked to backup all my boss' .m files (text files used by matlab). He isn't terrifically organized so they are distributed all over the drive. I have read a little about the cpio function and it seems like this might be a good option to use.
I figure the command would look something like this:
find -name "*.m" -print | cpio -ov > mfiles2007.cpio
Will this command do what I expect it to? Also, do I need to worry about permissions (i.e. should I be logged in as root?) Is there a better command for me to use?
Thanks for any advice you can offer!
Paul
- 02-24-2007 #2
Well, when you say they're all over the drive, do you mean this literally, or spread all over some certain directory?
The basic command you want is:
Remember: the pattern that -name uses is a regular expression, not a shell pattern.Code:find /path/to/the/subtree/you/want/to/check -name '\.m$' -print | cpio -ov > /path/to/archive
EDIT:
I am incorrect: -name DOES use a shell pattern. My mistake.
The main problem with your find command is that you don't tell it where to start looking. If I want to do all subtrees under /home, for instance, I need to name /home explicitly.
As far as permissions, it's safest to run this as HIS user, because this way you will only archive files that he can access in the first place (instead of accidentally adding system files that root can access).DISTRO=Arch
Registered Linux User #388732


Reply With Quote