General :: "find" Command In Backup/zip Script?
Feb 13, 2011
I am fairly new to scripting and I am trying to write a script that finds and zips a file named file1.xml from multiple sub-directories. So basically I want to find them and zip them all together. The disk directory structure is as follows:
/mnt/data/user_name1/db/file1.xml
/mnt/data/user_name2/db/file1.xml
(etc, etc where user_name varies)
This is what I have so far, but I keep getting an error relating to the -name command.
filename=`date +%d%m%Y-%H:%M`
find /mnt/data/ -name file1.xml -maxdepth 2 -type d | zip -rp $filename.zip -@
I keep getting the following error but don't know how to fix it. Is what I am trying to do even possible?find: warning: you have specified the -maxdepth option after a non-option argument -name, but options are not positional (-maxdepth affects tests specified before it as well as those specified after it).
View 4 Replies
ADVERTISEMENT
Jan 20, 2011
I am using Cron for nightly backups to a usb device. I was just wondering in my script for the backup, how do I find the location of my usb device.
View 2 Replies
View Related
Jul 21, 2011
my laptop has a 320 GB hdd which is dual booted with win 7 and linux mint.If i remember i dont think i am using the entire 320 GB from the hdd,may be around some 200 GB.If i use a DD command and back it up to an external 500 GB hdd,will it back the entire 320 GB or only the data which is of 200 GB ?
I want to have a full backup of my HDD ,incase the hdd fails in laptop i can mirror it to a new hdd from the external hdd.
View 1 Replies
View Related
Sep 7, 2010
I have 4 Linux machines with cluster.My target is to find all kind of IP address (xxx.xxx.xxx.xxx) in every file in the linux system remark: need to scan each file in the linux system and verify if the file include IP address if yes need to print the IP as the following
more /etc/inet/file.example1
182.23.2.4
255.255.0.0
10.10.1.1
View 1 Replies
View Related
Sep 11, 2009
I am trying to do a find/grep/wc command to find matching files, print the filename and then the word count of a specific pattern per file. Here is my best (non-working) attempt so far:
wc `find . ( -name "*.as" -o -name "*.mxml" ) -exec grep -H HeightResizableList {}` ;
View 10 Replies
View Related
Jul 15, 2011
Is there a way to specify to find that I only want text files (and not binary files)? Grep has an option to exclude binary files, so I thought find probably has a similar feature, but I've been unable to find it.
View 2 Replies
View Related
Aug 7, 2010
I am working in ubuntu 9.x (linux karmic kernal) .I have restored the content from CD to hard disk. In the mid way of this process, it was failed. I would like to know this below thiongs,
1) which position it got failed ?
2)Any offset option is there in linux to point the particular CD position ?
View 1 Replies
View Related
Jan 25, 2009
I know how to search for normal files but can you let me know " How to search for 5 setuid files on the system. Also explain, for each file, why setuid mechanism is necessary for the command to function properly"
View 1 Replies
View Related
Aug 3, 2010
am new to linux and trying to find a file in sub directories using find command as:find .-name *.jpg -type fBut I am unable to get the result as find command is not permitted by the server administrator.Is there any way to find files without using find command.
View 14 Replies
View Related
Mar 23, 2011
I'm going to be using this command to back up my files:
Should I change anything or is it ok?
View 4 Replies
View Related
Apr 3, 2011
I'm new to Linux and I am currently using the Ubuntu distro. What I'd like to know is whether there is a program or command I can use to back up my hard drive with Ubuntu? I have an external drive that I can use for this purpose but I don't know how to set it up for Ubuntu or Linux generally.
View 2 Replies
View Related
Dec 5, 2010
I back up all my digital photos to a couple of places. I've been using the cp command, but--given the personal value--have started to wonder if there's a more reliable way. I'm no stranger to Linux, Bash, Perl, etc., so I could write something to copy and compare md5 hashes, but I was wondering if something already exists (reinvention, wheels and what-not).
Most of my googling for copy and (verify|valid|check|hash|confirm) turns up rsync. However, as far as I can tell, rsync only uses hashes to see if a file needs to be updated. It doesn't perform a hash comparison afterward. For this use, specifically, the files are binary and typically 8-10MB.
View 3 Replies
View Related
May 22, 2010
Does the dump command back up entire file-systems or is it capable of backing up subsets of a file-system? And is tar capable of taking device names (for file systems) as input to be archived?
View 1 Replies
View Related
Sep 8, 2010
I want to scan a particular directory recursively and run a particular command with each file as input. For this I am using "find /dir/path". I dont want to write any long script containing loop on the output of "find". I want a single command which will allow me to run a command on each file of the "find" command output.
View 3 Replies
View Related
Mar 31, 2010
When I run find command with exec option, it just hangs on me. what am I doing wrong?
find /stdlist -type d -mtime 0 -exec cp -r {} joblogs ;
View 7 Replies
View Related
Oct 21, 2010
#!/bin/shLOOK_FOR="NTLMAuthenticationFilter"for i in `find ./ -name "*jar"`doecho "Looking in $i ..."grepjar -e $LOOK_FOR $idoneI wrote the script above, and try to find if there any file name LOOK_FOR exist in those jar,my quest is: grepjar -e $LOOK_FOR $ihere how can I check if there are any successful result , and output them ?
View 2 Replies
View Related
Nov 1, 2010
What is the difference between *.xml and *.xml in find command in Linux/macThe results of:find . -name *.xml and find . -name *.xml are different. But why?Also, is locate '*.xml' better than find? Which one is the most commonly used?
View 1 Replies
View Related
Aug 12, 2010
I've got a script where I have to parse out the last modified time for a large amount of files. Piping the output for "ls" into "cut" seems to work most of the time, but the output is unpredictable.The "fields" argument doesn't find the date modified columns consistently, and using character count is as well since the output can vary in width depending on the file name
View 3 Replies
View Related
May 17, 2010
I want to know the command which will list the local users created by me not system users.
View 6 Replies
View Related
Jun 13, 2010
How to find info and contents of the SD card via linux terminal. I found a command "mount"in internet. According to it it's in dev/sdb/.. but I didn't found such. I saw dev/sdc/
View 5 Replies
View Related
Jan 20, 2011
command to find the Distribution of Linux.
View 7 Replies
View Related
Feb 5, 2011
i have this find command to find modified files and copy them.Code:find $SRC_DIR -type f -ctime -1|xargs -i cp --parents {} $BACKUP_DIR/$DAY/and it works good but it want to exclude files that exist in some folders like $SRC_DIR/cash and $SRC_DIR/woks/tmp
View 3 Replies
View Related
Jun 20, 2011
If someone has done something wrong on a shared linux machine. If i want to find out who is that person or ip from where it is been done what are all the possible ways. 1 possibility I thought was to get the PID of the command and get other details from that PID?
View 4 Replies
View Related
Oct 27, 2010
t has been long time since i used the command that used to display the most widely used command in the distribution .It was in following format.(I guess it was a combination of history head sort grep or something like that)
50 ls -ltr
3 neat-tui
1 touch abc
I tried finding the command in google but wasnt able to find it
View 1 Replies
View Related
Jul 12, 2010
Ive tried to rsync from one ~/home on hdd a, to ~/home hdd b, using a live cd, but it returns a load of; eg:
rsync: opendir "/media/a2ab9331-effd-4855-8e0a-6c7f1a9d63b5/home/nnjond/.Skype" failed: Permission denied (13)
So i think i should fresh install and it would be convenient if i knew the refined commands to locate the saved files in /home hdd a, since 02_06_10 (not including all the hidden or deleted files), and then copy to a memory stick using the nautilus gui.
View 2 Replies
View Related
Jan 10, 2011
I'm in a directory containing various files and subdirectories, one of which is called BACKUP and is initially empty, what exactly happens if I launch the following command line:
Code: cp -R . BACKUP???
If I'm not mistaken, all the content of the current directory should be copied into the BACKUP directory, apart from the directory BACKUP itself. Actually I get a message saying something like:
Code: cannot copy a directory onto itself BUT when I look into the BACKUP directory I find another directory called BACKUP which I did not expect to find. Moreover, if I launch the same command again I get the same message (repeated two or more times) and then I find that inside the "second" BACKUP directory there is a third one, with the same name again. In other words, every time I launch the command I get a deeper tree of "BACKUP" directories, as if the command was messing everything up. I know that most probably I'm the one who's messing things up and I also know the "problem" can be easily bypassed by using as a destination for the copy a directory located elsewhere, but I'd like anyway to understand the reason for such a behaviour.
View 3 Replies
View Related
May 25, 2010
My goal is to find all pdf files on a remote machine, so I resort to the useful command find. So I type find .pdf or find .pdf" and I get nothing. I do the same on my machine and I get nothing. I do a regular search from the menu on my machine and I find quite a few pdf files. Would somebody please tell me what am I doing wrong?
View 5 Replies
View Related
Jun 29, 2011
I need to find out hardware information for the below items under Linux:
CPU (and cores)
CPU speed
Memory
Hard disks
OS version
View 6 Replies
View Related
Aug 17, 2011
Is there any command in Linux which will find a particular word in all the files in a given directory and the folders below and replace it with a new word?
View 4 Replies
View Related
Apr 12, 2010
We often require to find an equivalent text command for any GUI operation. Just as an example we click on a folder (say ABC) from the current directory in order to see the contents of that directory. The equivalent command for it to happen would be->
Code:
cd ABC ls Now the thing is that we often don't know what that equivalent command will be. So I want to know that is there any way out to find it. What I want to do is that I shall perform any operation using mouse in the GUI mode(whatever operation it could be) and then I can see a log file to see what I actually did last(rather what the command would have been if I have worked in the text mode)...
View 1 Replies
View Related