General :: Use Exclude Option In"rm" Command To Exclude Some Files/folders?
Feb 3, 2010
i have created on folder in my server to upload some regular states. I want that user can modify or upload already stored files. but, should not upload any unwanted files orfolders.for that i want to use "rm" command as auto scheduler (putting this in cron tab.so that all files will be removed except some required files / folders for which this upload facility is activated. users are using secure-shell for uploading data.
I have the following command which finds all files that have changed in the last day and lists them. How can I exclude hidden files like .bash_history?
I don't know why --exclude doesn't work when I use tar command. Please see this code Code: mahmood@pc:~$ l a/ 1.txt 2.txt 3.txt b/ mahmood@pc:~$ tar cvjf compressed.tar.bz2 --exclude=/home/mahmood/a/b/ a/ a/ a/2.txt a/1.txt a/3.txt a/b/ mahmood@pc:~$ As you can see although I excluded b/ but tar command ignored that.
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
I'm trying to find all java files in bash that contains the method "assign()".I would like to retrieve the same list except without the Test* files. How can I do that?
I have network shares automounted in /media and I want to exclude them from my automatic scheduled ClamAV scan in Maverick. How do I do this? I can't find any CRON link or script that actually starts the scan. Is it the Daemon that does this?
Well i downloaded a program with many .deb files ( At least 15 ) so i wanna execute them all trough the terminal so i typed
Code: patowlmc@patowlmc-desktop:~$ cd /home/patowlmc/Downloads/i386 patowlmc@patowlmc-desktop:~/Downloads/i386$ sudo dpkg -i *.deb Readme.deb: command not found
As you can see all files in the folder are .deb packages, but one: The Readme file, wich is a text file.
I know I just have to move the file to somewhere else, and everything should work, but i wanna know if there's a command for excluding a file or something.
P.D. I totally trust the program, so don't worry about so many .deb files.
opensuse v11.2, linux 2.6.31.12-0.1-desktop x86_64 ZIP v2.32
I wish to exclude some files from a zip archive. On other OSes to exclude an entire directory I would use the "-x" option like so:
Code: zip -r archive-name * -x dir1/* Simple. And just add "-x"'s as needed (or use an exclusion file).
Not how it works here, it would seem. AFAICT all "-x" options are ignored. (The entries in an exclusion file also.) For instance, "-x diy/mplayer/*" should ignore everything in the <diy/mplayer> directory. It does not. I have tried fully qualified paths as well; no joy.
I was thinking of migrating my apt-mirror repository to the recommended ftp scrips: [URL] .....
I pre populated my pool with already downloaded files, and setup the scripts.
However, if I run the bin/ftpsync, and monitor rsync with lsof -p, I can see that it is still downloading files from oldstable (wheezy) despite exclude options.
I'm guessing it's a configuration error, but I can't seem to figure it out. Any thoughts? My etc/ftpsync.conf is as follows:
Actually, I don't think it works like I thought it did. A few guides I found listed the exclude options, but the sample config file has this:
Code: Select all## If you do want to exclude files from the mirror run, put --exclude statements here. ## See rsync(1) for the exact syntax, these are passed to rsync as written here. ## DO NOT TRY TO EXCLUDE ARCHITECTURES OR SUITES WITH THIS, IT WILL NOT WORK! #EXCLUDE=""
So it looks like it doesn't exclude the suites at all.
In reading the rsync man page and browsing a lot of websites, I ended up a bit confused, or maybe it was just too much eggnog. Anyway, to exclude a directory "videos" with everything in it, which is /home/user1/camera/videos and I'm rsyncing the whole user1 directory to an external drive
I'm trying to backup a whole startup disk to another with GRSYNC but I don't need some files or directories. For example, I don't want to backup my 'swapfile1' (I do not have a dedicated swap partition) or the 'media' directory' in order to no enter a looping sync.I've searched the web for the correct syntax of the --exclude command but none have worked if applied in the advanced option "before" rsync starts. These a sample of NOT workin syntaxes:
exclude /media or -- exclude 'media' or -- exclude "media"
same for swapfile1:
exclude swapfile1 or -- exclude 'swapfile1' or -- exclude "swapfile1"
any tips from you guys on how to filter my awk output?I want to exclude last 5 characters using awk in my tcpdump result.I don't want to include ".443:" in my tcpdump using awk.
I'm trying to create backup/archive my Ubuntu 10.04 system files (so I can restore it in case my system get corrupted). More specifically, I'm trying to zip the important files in my root directory not including my home directory (which includes my documents which I backup separately/more frequently) to an external hard drive attached via USB (called 'My Book').Since File Roller didn't give me quite the level of control I was looking for, I created a script that I could execute to backup and archive regularly.
I want to search files excluding the NFS find / -mount -name 'filename' restricts the search only in the root disc partition,but the file can be in other partitions also.Is there any way to exclude the NFS only...
I tried to run one grep that excludes symlinks and pipe it into a second that searches for my pattern but I continue to get the recursive directory loop error. As a result (I think) my grep is incomplete as the search just loops between directories symlinked together.
I am trying to exclude multiple directories when using tar. I can do it for just one directory with exclude= directory.I can also do it for multiple directories by typing that code again and again.As you can see im trying to call this variable that has endless amounts of directories in it seperated by a space.. but when run it doesnt work! It will however work if i just put one directory in the variable. Any ideas?
[ --exclude FILE ] [ -X, --exclude-from FILEI tar to tar some directory and exclude a directory , I tried tar -cvf /tmp/test.gz ./* --exclude ./temp but not work , and the parameter --exclude seems exclude file only not directory , can advise what can i do
I'm trying to copy files from my local directory to a remote site using rsync.I want to include in the copy all the java files and exclude all the .svn directories, but I can't do it.
I want to exclude all log files from being transferred from the src to dest and delete all existing ones on the destination so im using --exclude=*.log with --delete-excluded which works great ...
but i want to keep a certain log file intact on the destination. I want a --exclude-from-delete option
I am trying to restore a tar file that contains a directory I cannot nor want to restore. How can I explicitly state the name of the directory? command I am using:tar -xzvPXf <tar file name>.tgz exclude-file=<directory>I have tried it with the exclude-file before the tar file name and same results. No restore.
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.
In Midnight Commander, is it possible to exclude some directories/patterns/... when doing search? (M-?) I'm specifically interested in skipping the .hg subdirectory.
I was trying to make an interactive directory menu.But in the directory where he has to read, there are a few directories that i don't want my menu to show and the "." and ".." still shows to...I just changed all my specific names so you can modify it easier...and here is my code..
I have to administer a few mail servers, a mail log server, 4 nameservers and a web server -all running on Centos 5 server distributions. Now I have a task: to avoid accidental crashes on the production servers while installing updates, my boss asked me to do clones (these clones will all be VMware virtual machines) of the servers (EXCLUDING the actual e-mails and mail log contents) and then to run those clones on VMWare Server. This way, first I will install and test updates on the clones and - if they will be running without crashes - I will apply the updates on the real production servers themselves. I have already installed VMWare Server 2.0 I have a few questions:
- How do I build the virtual machines to exclude the actual mail files and mail logs? Can I use VMware Converter for this purpose, or do I have to use another program? - How do I actually do this cloning? Is there a tutorial on how to do this?
Sometimes when I do "ls -al" I am given a list of files with Permission Denied messages. If I do "ls -al | grep -v 'Permission'" it'd still list them on the screen. Is there anyway to stop this?I want to be able to do this ultimately but not when it keeps giving me these Permission Denied file names.find . -user 'username' -exec rm -rf '{}';
I am using livecd-creator with the fedora-livecd-desktop.ks file to create livecd/usb images. The image that is created includes several languages (some are listed below). How can I only include one or two specific languages? Will I have to specify to remove each language group? If so, what is the syntax for yum?
Im trying to make backups using tar, and incremental backups using --newer. The scripts are:
Code: tar -czvf $DISKPATH/backupRepos.tgz /home/repos/ --exclude /home/repos/Temp for general backup (on saturdays) and Code: tar -czvf --newer="`date -r $DISKPATH/backupRepos.tgz +%F`" $DISKPATH/backupRepos-inc.tgz /home/repos/ --exclude /home/repos/Temp/ for incremental the rest of the week.
The problem is that the first script runs OK, excluding /home/repos/Temp from the backup, but on the second, it makes incremental OK, but doesnt exclude Temp folder. Anybody knows how can i fix this script to continue making incremental but excluding also?
I'd like to backup my whole system to a 2nd disk using rsync (other tools not possible).Which paths should I exclude from the packup?I was thinking about /proc, /dev, the lost+found directories...What other paths am I forgetting?