General :: Excluding Directories With Find?
Jun 10, 2011
I am trying to exclude 2 directories with find and pass it into cpio. I have tried
Code:
find . -depth -path '.evolution' -prune -o -path '.gconf' -prune -o -print|cpio -aov > /media/caca/full$date
./.gconf/apps/evolution/memos/%gconf.xml
./.gconf/apps/evolution/memos
[Code]....
View 4 Replies
ADVERTISEMENT
Jul 12, 2010
I have tripwire 2.4.1 up and running on one of our servers, and I am now in the process of configuring it to exclude some files and/or directories that are known to change periodically between integrity checks.
I did some reading on the subject, and one file that came up was the tw.config file. However, when I did a search for the file, there was no instance of it on the server. My next thought was to modify the tw.pol file, and I did try to list some files to be excluded. However, when I tried to update the policy, I got an error message which indicated the syntax that I entered within the tw.pol file was incorrect.
If the tw.config file does not exist, can I create it, and modify the tw.pol file to indicate where the file is located on the server?
View 1 Replies
View Related
Jan 20, 2010
I want to search file excluding the NFS ...find / -mount -name 'filename' restricts the search only in the root disc partition,but the file can be in other partitions alsoIs there any way to exclude the NFS only.
View 2 Replies
View Related
Oct 5, 2010
I know I can do find . -type f, but that includes binary file and I couldn't find a way to exclude them with find
View 4 Replies
View Related
Oct 22, 2010
I have spent the last hour searching for a solution to this, but I can't get it to work. Here is what I am trying to do:
I have directories for different months in one folder. So for example Code: ../folder/Jan/
../folder/Aug/
etc. Some of the folders have a dot in front of the month as so: Code: ../folder/.Sep/
../folder/.Oct/
[Code].....
I am trying to find all the csv files EXCEPT those in a folder that has a dot. For example I want all the csv files in ../folder/Jan/ but I want none in ../folder/.Oct/.
I also want to exclude all the files in the /Aug/ folder that represent days 10-31.
Here is what I have so far: Code: find /some_path/folder/ ( ! -name "Aug[10-31]*.csv" ! -path "/.*/" -name "*.csv" ) | more This command lists all the .csv files except those in the /Aug/ files. So it just ignores the /Aug/ folder completely but lists every other .csv file.
View 3 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
May 20, 2010
I found a script on webmaster world that mostly does what I need it to, but have been making modifications to tailor it to my specific needs.I know that //..*/ tells awk to ignore hidden directories, how do I define more directories to ignore? (i.e. temp, var, etc)? I've tried playing with prune before the awk command with limited success...I know that there are many ways to do the same thing and keep running into brick walls.
View 11 Replies
View Related
Dec 17, 2010
Write a script to list all the differences between two directories.
View 1 Replies
View Related
Feb 23, 2010
I've got a simple command that does almost what I want.
The following will locate all files with a suffix of '_compressed.swf' and copy each into its same directory with a '.bak2' appended:
However, I need to replace '_compressed.swf' with '_content.swf' I'd like to use find, rather than recursive flag on cp for consistency.
Objective
In: /content/somefile_compressed.swf
Out: /content/somefile_content.swf
View 3 Replies
View Related
Oct 29, 2010
I have a question which has been in part answered many times but nothing I found relateds completely to my situation. I am sure there will be people who will say RTFM but believe me I did, and searched as well but to no avail. I have a situation where I want to copy files created withing last hour in one directory into another one. The problem is that that the directories are on different levels in the dir tree so the absolute path is different. But I want to keep the relative path the same.
I want to copy new files from /mnt/path_to_webdav/user to /home/user. so if there is new file /mnt/path_to_webdav/user/doc/xy.txt I want it to be copied to /home/user/doc/xy.txt. Also if there is a new dir, say /mnt/path_to_webdav/user/newdir I want a new dir to be created in /home/user/newdir with all the files in it, should there be any. I can do find with exec and copy all the files into one directory.This is not what I want though. How do I preserve the relative path and get the files copied into their corresponding directories?
View 1 Replies
View Related
Jun 7, 2010
tell me the command used to find a specific word in directories and sub-directories in linux?
View 4 Replies
View Related
Sep 26, 2010
I need to strip the executable flag from all files within a certain directory and sub directories. Right now I'm doing it with a 2 step process
find /dir/ -type f -exec chmod ugo-x {} ;
find /dir/ -type d -exec chmod ugo+rx {} ;
Is it possible to modify the first line so that I can strip exec flag from all non-directory files? Since this needs to be done on a fairly regular basis across a lot of directories and files, I'd prefer not to use a bash script which would slow it down.
View 1 Replies
View Related
Oct 22, 2010
I want to move all files and directories that are 1 month old out to back up into a separate folder. There will be a lot of files and I want to make sure it copies properly. The problem I'm having is integrating a MD5SUM into it to check integrity. MD5SUM is not recursive, so I figured it would work in a loop when it copies each individual file, I'll do a md5sum on each file and delete that md5 once its verified it copied ok.
[Code]...
I also need some sort of error handling to output all md5's that didnt pass the hash check.
View 3 Replies
View Related
Jul 29, 2010
Just trying to set up a new backup using tar, but there are a few things I dont want to include. Using --exclude I can exclude sub-directories, but how do I exclude specific files in a subdirectory that are (for instance) executables or have a specific extension?
View 5 Replies
View Related
Dec 13, 2010
I have to write a script which would search the IP adesseses in a given directory.
Below is my command.
Code:
grep -HwrnI --exclude=*.log '[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}' *|grep -v '/.svn/'
I have to exclude the following from search resluts.
1. Comments
a. Can be starting with /, * or #...
b. Cane be between a line
EX: some text... #comment1
View 9 Replies
View Related
Jun 21, 2011
At present in my server the log folder was filled up and causing memory issue. So I am planning to write a script in such a way that the files which are older than 30 days will be deleted and also need to find the files which were not compressed and need to compress this file. Compression will exclude if the file was created on the same day.
View 12 Replies
View Related
Dec 19, 2009
i am in need of linux help. iam at college and i need this back/restore script to pass this final part of an assessment. i require a backup script that will not only backup but also restore files to the relevent directories. e.g. users are instructed to store all wordprocessor files in a directory named wp. so i am needing to create a backup directory and 3 directories within that and some files within the 3 directories and then back them up ot restore them. l know i should/have to do this myself by been trying to get/understand info for the last few days and came up with zero.
View 14 Replies
View Related
May 15, 2011
I want to make a webserver with multiple users allowed to login through SFTP to a specific folder, www.Multiple users are added, lets say user1 and user2, and all of them belonging to the www-data group. The www directory has an owner www-data and a group www-data.
I have used chmod -R 775 on the www folder, but after I try to create a folder test through my SFTP server (using Filezilla) the group of the directory created has only r and x permissions, and I am not able to log in with the second user user2 and create a directory within www/test due to a lack of w permission to the group.
I also tried using chmod 2775 on www directory, but without luck. Can somebody explain to me, how can I make it so that a newly created directory inherits the root directory group permissions?
View 2 Replies
View Related
Apr 28, 2011
Under Linux, I'm looking for a command to list the biggest file and/or the biggest directories under a directory.
View 3 Replies
View Related
Oct 5, 2010
How can only directories be listed, that do not have another child directory?
Imagine a structure like /A /A/AA /A/AB /A/AB/ABB /B /C /C/CC /C/CC/CCC /C/CC/CCC/CCCC I would like to use find to list only /A/AA /A/AB/ABB /B /C/CC/CCC/CCCC.
The starting point would be find . -type d, but neither -mindepth nor -maxdepth can be used, can -noleaf help (I could not get it to react the way I wanted it to)?
View 2 Replies
View Related
Mar 23, 2011
I am writing a script, in that my requirement is, if all the fill types stored in one directory from that we need to separate different different directories based on the file types.
for example in a directory(anish). 5 different types files
1- directory
2- .txt files
2- .sh files
like that and my requirement is the (1- directory is moved to one new directory(dir) which we are given in the script)and (2 .txt files are moved to another new directory(test) which we are given in the script)and ( 2 .sh files are moved to another new directory(bash) which we are given in the scrip)finally the directory anish should be empty..using bash script.how it is possible !!
View 7 Replies
View Related
Dec 26, 2010
I go to places-acces server-ssh and connect to a remote server with Nautilus.All ok.But I prefer to use vifm as my main file manager: I try to find the ssh-mounted devices in /mnt or /media but cannot fin them.Does anybody know where they are?
View 2 Replies
View Related
May 28, 2010
I'm having problems figuring out the process to find directories that DO NOT contain a certain file. I have a mp3 collection that all the album art is name "folder.jpg". Not all the albums have images. I need a way to find the albums/directories that do not contain "folder.jpg". I can find the ones that do contain "folder.jpg" with
Code:
find . -iname 'folder.jpg' -print0 | xargs -0 ls >> album_art
but that is as far as my bash-fu can take me. I'm not really sure what my next step is.
My directory structure is like such: a-z/artist/album/folder.jpg
View 5 Replies
View Related
Jan 9, 2010
how the "-prune" option works. I've searched quite a bit on line, and as far as I can tell, "-prune" works exactly the opposite as it says.
I'm using Apt-proxy, and I want to scan through the folders, and find files that end with "*.bz2" The problem is that the search takes a while because of all the "*.deb" files. Fortunately, they're stored in their own folder:
/var/cache/apt-proxy/ubuntu
/var/cache/apt-proxy/ubuntu-security
/var/cache/apt-proxy/partner
each have two folders:
[Code]....
View 5 Replies
View Related
Apr 7, 2010
this is my fisrt time in this forum. I got the following message when I an using arm-linux-insight: [root@localhost insight]# arm-linux-insight Tk_Init failed: Can't find a usable tk.tcl in the following directories: /usr/local/share/tk8.4 /usr/local/lib/tk8.4 /usr/lib/tk8.4 /usr/local/library /usr/library /usr/tk8.4.1/library /tk8.4.1/library
[Code]...
View 2 Replies
View Related
Aug 27, 2010
When I am in Nautilus, I want to be able to select a directory, then right click (or some other action) to do a file find on that directory. The gnome-search-tool would be a good candidate for this, if it could be an action in Nautilus. I know I can do a file find through other means, but Nautilus seems to be where I am when I want to search directories.
View 6 Replies
View Related
Dec 4, 2010
what i wanted to do was find all the files with a specific name from a tree, sort them by modification time and have their directory appended to them so that i knew where they were (because they all have the same name). i tried a whole bunch of different things and finally did this:
Code:
find . -type f -name world.sav -exec ls -l '{}' ; > ~/dfsaves.txt; gawk '{$1=""; $2=""; $3=""; $4=""; $5=""; print}' ~/dfsaves.txt | sort -n > ~/dfsavessorted.txt
this did the trick pretty well, but as you can see it is far from elegant and i think i'm doing some things wrong and kludgy
first thing i tried was "ls -lRt | grep world.sav" which worked except i couldnt distinguish the files because there were no directories. that took a lot of looking till i accepted i couldnt make ls print directories as well and append them to the files somehow that their relationship would be clear. i tried piping ls to find, doing it in reverse, passing them from grep etc. etc. until i read some more stuff online that got me using gawk and sort. the questions:
1. is there some other, more elegant and simple way to do this kind of detection and sorting?
2. is there any way to use a pipe after using exec? the semicolon seems to prevent this entirely, forcing me to use an intermediate file as above. i could just remove it later, but i'd prefer a straight piping.
View 8 Replies
View Related
Mar 8, 2010
I'm searching for a script which finds changes/differences in two (s)ftp directories. Not 100% sure if this is possible with just FTP or do I have to transfer the files beforehand?
Something like: ftpdiff user@host1/directory user@host2/directory.
View 8 Replies
View Related
Feb 19, 2010
i'm trying to make a script that gives one output if a directory in /home is older than one month, and another if the directory is less than one month old. I looked around and saw that the creation date for directories isn't stored, or at least i couldn't find it? How is this possible to do then?
View 2 Replies
View Related
Sep 16, 2010
I'm using CentOS 5.5. I am trying to write a script that will find recently created directories (touched within 30 days) and create a symbolic link to those directories in another folder. Here is the script:
#!/bin/sh
cd /home/chris/Documents/;
rm -rf ./recent_files/*;
find ./ -maxdepth 1 -mindepth 1
[code]...
View 2 Replies
View Related