Sponsored Content
Top Forums Shell Programming and Scripting How to delete all the files and folders inside all the directories except some specific directory? Post 302950815 by Little on Wednesday 29th of July 2015 03:22:24 AM
Old 07-29-2015
Quote:
Originally Posted by MadeInGermany
Code:
find . -type d \( -name archive -o -name log \) -prune -o -type f -print

If this correctly prints the files to be deleted then replace -print by -delete or -exec rm -f {} +
Thanks for the solution. Can you please explain it?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

delete files in specific directory

i have a directory "ABC" with lots of old files and sub directories in it. the issue now is i want to delete away files which are older than 15 days in "ABC" without deleting the files in the sub directories and without deleting the sub directory. i tried using find command but it will drill down... (2 Replies)
Discussion started by: legato
2 Replies

2. Solaris

How to delete Directory and inside files using Find command

I am using the following Command to delete Directory with contents. But this command is deleting inside files only not directories. is there any change need in my command? find -type f -mtime +3 -exec rm -r {} \; Thanks (3 Replies)
Discussion started by: bmkreddy
3 Replies

3. Shell Programming and Scripting

Copying specific files from remote m/c to specific folders

Hi All, I am trying to rsync some of the latest files from remote m/c to my local linux box. Folder structure in my remote m/c looks like this /pub/Nightly/Package/ROLL/WIN /pub/Nightly/Package/SOLL/sol /pub/Nightly/Package/SOLL/linux Each of the folder contains gzip files which on daily... (0 Replies)
Discussion started by: jhoomsharabi
0 Replies

4. Shell Programming and Scripting

Delete all files if another files in the same directory has a matching occurence of a specific word

Hello, I have several files in a specific directory. A specific string in one file can occur in another files. If this string is in other files. Then all the files in which this string occured should be deleted and only 1 file should remain with the string. Example. file1 ShortName "Blue... (2 Replies)
Discussion started by: premier_de
2 Replies

5. UNIX for Dummies Questions & Answers

[SOLVED] Delete files and folders under given directory

I have a requirement to delete the files and folders under a given directory. my directory structure is like this.. Data | A(Directory) |_PDF(Directory)----pdf files |_XML()Directory --xml files |--files | B(Directory) |_PDF(Directory)----pdf files |_XML()Directory --xml files ... (1 Reply)
Discussion started by: ramse8pc
1 Replies

6. Shell Programming and Scripting

Find specific files only in current directory...not sub directories AIX

Hi, I have to find specific files only in the current directory...not in the sub directories. But when I use Find command ... it searches all the files in the current directory as well as in the subdirectories. I am using AIX-UNIX machine.Please help.. I am using the below command. And i am... (2 Replies)
Discussion started by: aakishore
2 Replies

7. Shell Programming and Scripting

Delete all files with specific extension in directory tree

I'm sure this has been asked many times, but a search didn't turn up a definitive best method for this (if there ever is such a thing). I have been using rsync to back up my main data directory, but I have accumulated a large number of older backups that I don't need. All of the files I don't... (14 Replies)
Discussion started by: LMHmedchem
14 Replies

8. Shell Programming and Scripting

Delete all files if another files in the same directory has a matching occurrence of a specific word

he following are the files available in my directory RSK_123_20141113_031500.txt RSK_123_20141113_081500.txt RSK_126_20141113_041500.txt RSK_126_20141113_081800.txt RSK_128_20141113_091600.txt Here, "RSK" is file prefix and 123 is a code name and rest is just timestamp of the file when its... (7 Replies)
Discussion started by: kridhick
7 Replies

9. Shell Programming and Scripting

Move specific folders and subfolders in a directory

I am trying to move specific folders and subfolders within a directory using the below. I can see the folders to move and they are at the location, but I am getting an error. Thank you :). mv -v /home/cmccabe/Desktop/NGS/API/6-10-2016{bam/{validation,coverage},bedtools /media/cmccabe/"My... (6 Replies)
Discussion started by: cmccabe
6 Replies

10. Shell Programming and Scripting

Bash to list all folders in a specific directory

The below bash is trying to list the folders in a specific directory. It seems close but adds the path to the filename, which basename could strip off I think, but not sure why it writes the text file created? This list of folders in the directory will be used later, but needs to only be the... (5 Replies)
Discussion started by: cmccabe
5 Replies
ar86(1) 						      General Commands Manual							   ar86(1)

NAME
ar86 - Create, modify, and extract from archive file SYNOPSIS
ar86 operation archive [file...] ar86 positional-op member archive [file...] DESCRIPTION
The ar86 program is used to create, examine and modify archive files produced by the Dev86/ELKS toolchain. OPTIONS
The ar86 command requires that the operation to be performed on the archive be specified as the first option. If the operation is positional then the next option is the archive member marking the position. This is followed by the archive file name and any list of file names. Operations One of the following operations can be specified d delete the listed files from the archive. m move the named files. By default files are moved to the end of the archive unless a positional modifier is present. p print the contents of archive members to standard out. If a file list is included only those members are printed. If the v modifier is present each file's contents are preceeded by a new line, a line with the string member, a space character, the member name, and two following newlines. q quickly add the files to the end of the archive without checking to see if they already exist in the archive. This operation will ignore any positional modifiers. Creates the archive file if it does not exist. r replace archive members with the files listed. If the file name is not present in the archive it is added to the end of the archive (or to any explicitly specified position). Creates the archive file if it does not exist. t table; list the file names of archive members. If a file list is present only those files that are present in the archive are listed. The v modifier prints member attributes. x extract the named files from the archive into the current directory. If no files are specified all the archive members will be extracted. Modifiers The following modifiers may be used with the operations o original time stamps from the archive are preserved for extracted files when possible. s symbol update; this option may be used by itself to force an update to the symbol definition section of the archive (the __.SYMDEF member). If any files are specified they will be replaced as if the r operation had been specified. If no symbol definition section exists one is created. This option will also creates the archive file if it does not exist. u update files in the archive during a r (replace) operation. The files are added to the archive in exactly the same manner as replace except that an existing archive member will be retained (in its original position) if it has a modified more recently than the file being added. Note that this modifier acts as if a r operation has been specified (even it has not), and will actually override any other previously specified operation. v verbose; print additional diagnostic messages while processing the archive. Positional Modifiers The following modifiers specify where in the archive files are moved to or added. If any of these modifiers are specified then the second option to ar86 must be the name of an archive member. a after; files are placed after the specified archive member. b before; files are placed before the specified archive member. i same as b. EXAMPLES
To see the contents of an archive ar86 tv libfile.a To add some files to an archive ar86 r libfile.a file1.o file2.o to add some files after a member named mem.o and to update the symbol table ar86 rsa mem.o libfile.a file1.o file2.o BUGS
A l modifier will be accepted but ignored. RESTRICTIONS
This command is intended for use only with object files created using the Dev86/ELKS toolchain. SEE ALSO
as86(1), bcc(1), ld86(1) AUTHORS
(C) 1988, 1990 Free Software Foundation Inc. Changes for ar86 by Greg Haerr <greg@censoft.com>. COPYRIGHT
The manual page was written for Debian GNU/Linux, (C) 2006 Shyamal Prasad <shyamal@member.fsf.org>. It is distributed under the terms of the GNU General Public License version 2 (or any later version released by the Free Software Foundation). May, 2006 ar86(1)
All times are GMT -4. The time now is 05:39 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy