General :: Delete All Except Three Specified Directories?
Jul 29, 2010How would I delete everything in a directory except for three specified directories?
So far I discovered I can omit the directories like so in a find search code...
How would I delete everything in a directory except for three specified directories?
So far I discovered I can omit the directories like so in a find search code...
How can I delete Directories which are smaller than, say, 1000 KB?
I already have a file list from the command:
But I don't know how to proceed.
Update:
The output of:
Is something like:
how to write a short script file to read file (text) contains a list of directories name and delete everything in it. There are 10,000 directories - So there is NO WAY I can do manually.
View 8 Replies View RelatedI have tried to find the solution for my problem on this site and other sites but haven't found a good enough answer yet. Maybe some of you can help me out here?What i need is a script (bash preferrably) that can delete directories based on a date in its dirname.For example.I have a bunch of directories that is named
data-20110623/
data-20110624/
data-20110625/
[code]...
I would like to be able to recursively delete specific various files from a directory and sub-directories. For example:
Dir/
|_sub1/
|
|_ _rm *file1 *file2 *file3
[code]....
I'm looking for a Bash script that will go into a list of directories and delete all but the four most recently created files.
How can I do this?
i've been wondering how do i know if some users create/modify/delete file/directory in linux, i've been using pyinotify in python script.this script like the example from the manual:
Code:
#!/usr/bin/python
import pyinotify, os, time
[code]...
is there any way so that we can restrict root to delete a file/directories and What is extended file attributes.
View 12 Replies View RelatedI discovered two folders marked with a cross in my root:
- root
- lost+found
And when I'm trying to reinstall a newer version of Netbeans, 6.9.1. it claims that there is already something running in 'root folder "The installer lock file exists at /root/.nbifile/.nbillock"
The question is - is those folders are needed for Ubuntu working? -If not how to delete them? And one more question - how to delete a programme from the 'Applcations-Programming'? I tried to do that via 'System-Preferencies-Main Menu' and tried to delete a previous version of Netbeans, but it didn't work, - nothing happens, the previous version is still there, so I have two ones - 6.9.1 and 6.9.
I have two users in home on Debian stable: user1 and ftpuser.Proftpd is configured so that it uses ftpuser for clients.How to set it up so that user1 can modify, delete, etc.. all files and directories that ftpuser creates?
View 3 Replies View Relatedi 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 RelatedI 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?
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 !!
Is it possible to restrict users to their home directories and allow admins to have different home directories? Essentially I want users to have a folder in /var/www/html/$USER and admins to have either unrestricted access or have their root directory be ./ or /www or /etc. I have is set now so users have access to thier home direcotry but I need to upload web files as admin.
So far I have created:
chroot_list
user_list
[code]....
Instead of moving to trash, how can i make the delete button delete? Delete is already enabled on the right click menu.
View 7 Replies View RelatedSO after using Testdisk to recover some images, the folders recup_dir.1 & 2 have saved in my FIle System area, when ever I try to press delete noting happens. I have also tried rm -f -rrm -f -fIt still dont delete, I have also deleted my user account and made a new one, but the files are still there.
View 4 Replies View RelatedI am trying to use an old box as backup server. I have tried a couple of possibilities along the lines of:
Quote:
rsync -a --delete --progress --log-file=/home/$USER/info.txt -e ssh /home /etc root@192.168.0.106:/mnt/back
The problem is it does not delete files that has been removed from my local system?
I run the command as root on the local system.
(I realize I should properly not ssh into the server as the server's root but I'm having trouble with the permissions and I want to make sure everything else works before messing around with it)
Is there a way to cp directories using smbclient ?
View 3 Replies View RelatedI'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.
View 1 Replies View RelatedWhy is there no Delete when I right click like there is with Windows in ubuntu? Pretty much everything else is there like new folder and so on Is there some way to add it? Also why when i delete something does it not ask me if I am sure that i want to delete that file?
View 6 Replies View RelatedI misread this question and thought it was asking something I've needed for a long time. My question is slightly different: how to find directories whose contents exceed a certain size. Is there any *nix way to do this?
View 3 Replies View RelatedI want to restrict access to certain directories to my ssh users but allow them to read files by known path from there(mostly it's meant to be done by applications).
View 2 Replies View RelatedAre there shell versions that have a more intelligent tab completion? I'd like to be able to type cd foo-<TAB> Then it would show me the possible completions along with numbers that I can type to select one of them:
cd foo-<TAB>
(1) foo-bar1 (2) foo-bar2 (3) foo-bad
So, after <TAB> I would type 3 and it would take me to foo-bad. Alternatively, using the arrow keys instead of typing the number would be fine.
I try to sync two directories using rsync.
the source is on Linux, and the other is on windows.
So, I mount the directory on windows using the command mount -t cifs . in Linux system.
Then I execute rsync ....
Everything is OK, but rsync prints out
rsync: chown "/mnt/windows/A/." failed: Permission denied (13)
rsync: chown "/mnt/windows/A/readme.txt" failed: Permission denied (13)
I want to sync the directories without changing ownership.
I'm very new to working with the terminal on my macbook pro and am trying to understand how to navigate into certain directories with it. I can't seem to get out of my username directory. I'm trying to access MAMP/htdocs and get those files into my git repository. I'm new to all of this. I am typing and getting this:
David-Adamss-MacBook-Pro:~ davidadams$ cd Applications/MAMP/htdocs/barcodes
-bash: cd: Applications/MAMP/htdocs/barcodes: No such file or directory
I need to get the "davidadams$" out of that line but I don't know how to navigate out of it.
I need to backup some Directories but
sudo chmod 777 *
Wont include permissions for daughter dirs
I don't quite understand /etc/skel. I know that everything in /etc/skel will effect all NEW users, and that's about it.
Basically, what I'm trying to do is add the directories "home" and "work" to the users /home directory.
How do I do this?
I need to create subdirectories in about 300 existing directories - the subdirectory will have the same name in all 300 existing directories. How do I do this using the mkdir command using a regular expression or globbing?
View 3 Replies View RelatedI have a requirement. I need to write a shell script which will compare two directories residing in two different servers (SERVER A and SERVER B) and list out the discrepancies if found any. Script will be running from SERVER A.
View 3 Replies View RelatedI 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]....