Sponsored Content
Top Forums UNIX for Advanced & Expert Users Find all files in the current directory excluding hidden files and directories Post 302886637 by Don Cragun on Monday 3rd of February 2014 02:53:23 AM
Old 02-03-2014
The -prune primary in find ignores everything except directories, but the combination! -name ".*" -prune does not prune directories with names starting with a period. A rough equivalent of -maxdepth 1 for use in versions of find that don't have the -maxdepth primary is \( ! -name . -prune \).

If there is no -exec primary, no -ok primary, and no -print primary in the expression given to find, the -print primary is supplied by default.

The following is a slightly simpler command than MadeInGermany's suggestion and should produce the same results:
Code:
find . \(  ! -name . -prune \) ! -name ".*" -type f -mtime +${n_days}

This User Gave Thanks to Don Cragun For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

find excluding the hidden files

Hi , I am trying to use the find command with delete in a directory . Even though i use a wil character search the find command is checking the hidden files which inturn results in error . Can i avoid look that into the hidden files ?? I am using HP unix . find /cv1/ -name "ite*"... (3 Replies)
Discussion started by: arunkumar_mca
3 Replies

2. UNIX for Dummies Questions & Answers

Find Files in a Directory Excluding Subdirectories

Hi, I have a filename Location.txt in a directory /abc. Similar name file is present in its subdirectory /abc/xyz. I want to find the file which is present only in /abc and not in /abc/xyz. Please any1 of u can provide a quick suggestion. Its very urgent. Thanks, Amol (2 Replies)
Discussion started by: Amol_Dicholkar
2 Replies

3. UNIX for Dummies Questions & Answers

List files that are not directories from current directory

I can't manage to list all files that are not directories from current directory. (2 Replies)
Discussion started by: beni22sof
2 Replies

4. Shell Programming and Scripting

mget * (obtein files from current directory but not the files form sub-directories)

Hello, Using the instruction mget (within ftp) and with "Interactive mode off", I want to get all files from directory (DirAA), but not the files in sub-directories. The files names don't follow any defined rule, so they can be just letters without (.) period Directory structure example: ... (0 Replies)
Discussion started by: Peter321
0 Replies

5. Shell Programming and Scripting

Find all files for a user, excluding a directory

I have been searching, and cannot find an answer for this. I am trying to find all files for a user, lets call him (test001), and I want to exclude a specific directory. Here is the command I run, it finds all files: find / -user test001 I get this result: > find / -user test001 ... (4 Replies)
Discussion started by: steve2x4
4 Replies

6. Shell Programming and Scripting

How to list all the files, directories and sub-directories in the current path except one directory?

Can anyone come up with a unix command that lists all the files, directories and sub-directories in the current directory except a folder called log.? Thank you in advance. (7 Replies)
Discussion started by: Manjunath B
7 Replies

7. 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

8. Shell Programming and Scripting

Find command to search files in a directory excluding subdirectories

Hi Forum, I am using the below command to find files older than x days in a directory excluding subdirectories. From the previous forums I got to know that prune command helps us not to descend in subdirectories. Though I am using it here, not getting the desired result. cd $dir... (8 Replies)
Discussion started by: jhilmil
8 Replies

9. Shell Programming and Scripting

Find/searching files in subdirectories excluding the fiels in Parent Directory

Hi All, requirement is to find and remove the files from sub directories but it should exclude the files from parent directory. At present i am using the below one but it finds and remove files from both parent and sub directories. find ${PATH} -type f \( -name securitas\* -o -name \*gz... (1 Reply)
Discussion started by: Naveenkk
1 Replies

10. Shell Programming and Scripting

Find command excluding directories and some files

hello. I try to print a list of files but excluding some directories and some files. I would like to write a command for : find "from_dir" "ignore dir1, dir2, ..." "ignore file1, file2,...." "where file are older than 2017-02-03T06:00:00" Note that "DO_IT" is a local function in the script... (5 Replies)
Discussion started by: jcdole
5 Replies
GIT-PRUNE(1)							    Git Manual							      GIT-PRUNE(1)

NAME
       git-prune - Prune all unreachable objects from the object database

SYNOPSIS
       git prune [-n] [-v] [--progress] [--expire <time>] [--] [<head>...]

DESCRIPTION
	   Note
	   In most cases, users should run git gc, which calls git prune. See the section "NOTES", below.

       This runs git fsck --unreachable using all the refs available in refs/, optionally with additional set of objects specified on the command
       line, and prunes all unpacked objects unreachable from any of these head objects from the object database. In addition, it prunes the
       unpacked objects that are also found in packs by running git prune-packed. It also removes entries from .git/shallow that are not reachable
       by any ref.

       Note that unreachable, packed objects will remain. If this is not desired, see git-repack(1).

OPTIONS
       -n, --dry-run
	   Do not remove anything; just report what it would remove.

       -v, --verbose
	   Report all removed objects.

       --progress
	   Show progress.

       --expire <time>
	   Only expire loose objects older than <time>.

       --
	   Do not interpret any more arguments as options.

       <head>...
	   In addition to objects reachable from any of our references, keep objects reachable from listed <head>s.

EXAMPLE
       To prune objects not used by your repository or another that borrows from your repository via its .git/objects/info/alternates:

	   $ git prune $(cd ../another && git rev-parse --all)

NOTES
       In most cases, users will not need to call git prune directly, but should instead call git gc, which handles pruning along with many other
       housekeeping tasks.

       For a description of which objects are considered for pruning, see git fsck's --unreachable option.

SEE ALSO
       git-fsck(1), git-gc(1), git-reflog(1)

GIT
       Part of the git(1) suite

Git 2.17.1							    10/05/2018							      GIT-PRUNE(1)
All times are GMT -4. The time now is 12:24 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy