1
vote
1answer
30 views

Find files belonging to a group

Actually I want to find all the files and folders that are under the same group, for example I have this : [test] user1/sam a.txt user9/sam b.txt user4/sam I'm looking for a command ...
2
votes
2answers
46 views

List of subdirectories that contains a particular file name

I am wondering if i can do this in a single shell command. I am in home directory and want to find a list of subdirectories that contains a particular file. The file name and the depth is always ...
1
vote
2answers
64 views

finding latest date and date modified file and using sed

I have a series of files that contain a date and I need to get the file which has the latest date, and the latest date modification and pipe it to sed. I have tried various approaches and I cannot ...
4
votes
5answers
283 views

Clone directory tree structure and copy files to the corresponding directories modified after a specific date

I have a folder with more than 30 sub directories and I want to get the list of the files which was modified after a specified date(say sep 8 which is the real case) and to be copied with the same ...
0
votes
2answers
49 views

Remove by date in Shell Script

I have a shell script that creates a backup of a database. I would like to keep the last 7 days for files. What is the syntax I need to remove files in a directory by date or can I keep the newest 7 ...
3
votes
3answers
282 views

How to integrate mv command after find command?

Given a scenario I was searching for file name which contain AAA withing it on a path using following command: find path_A -name "*AAA*" Given the output shows from the above command, I want to ...
4
votes
2answers
105 views

Why does 'find -delete ' delete all files in a directory recursively

So the following behaviour of unix find just cost me dearly: > touch foo > touch bar > ls bar foo > find . -name '*oo' -delete > ls bar > touch baz > ls bar baz > find . ...
2
votes
1answer
31 views

How do I search files without certain extensions in their names?

I would like to search recursively in all the files and directories under a directory for some strings e.g. library. I also would like to exclude files and directories which store downloaded ...
3
votes
2answers
116 views

Why does find -exec du sum up differently?

I have family pictures and movies in a folder /media/data/Selbstgemacht and I'd like to find the size of all pictures. In /media/data I use find Selbstgemacht -type f -iname '*.jpg' -exec du -ch '{}' ...
6
votes
4answers
124 views

Find newest file. Multiple Filetype restrictions

I want to write a command that gives me the newest file in a directory recursively. But that's not my only limitation. The files has to be an mp3 or a jpg file. (case insensitive prefered) I only need ...
3
votes
3answers
348 views

Moving latest files from one directory to another

I'm trying to move newest files from one directory to another directory. The find command finds the files but not moving them to another directory. The destination directory exists. $ cd ...
0
votes
0answers
44 views

Storage Formats for Flat File DB

Currently I use a flat file database with find -type f -ls to store information for about 400GB of files. I'd like to store also the md5sum/sha[1|256]sum of the files. Because the files are often ...
3
votes
2answers
128 views

Find files in directory with paired names

I'm running tests of a variable-size-and-contents test set. Data files are added and removed frequently. I'm looking for an automated way of gathering a file list. All files are in subdirectories of ...
4
votes
3answers
123 views

zsh's “echo SomeText >> **/filename” in other shells

I need to fill all files with a specific filename (recursively) with a text. In zsh this can be done with echo SomeText > **/TheFileName I search generic solutions for sh-compatible and/or tcsh ...
2
votes
2answers
453 views

find the single largest file

We host a share of size 4 TB. How efficient is it to find a file with highest size. Usually we use: du -ak | sort -k1 -bn | tail -1 and it is not easy to scan through a share of such huge size and ...
6
votes
4answers
638 views

Delete all files in a directory whose name do not match a line in a file list

I have a directory with 1000+ files. In a text file, I have about 50 filenames, one per line. I'd like to delete all the files in the directory whose filenames don't correspond with an entry on the ...
6
votes
3answers
167 views

Find the top 50 directories containing the most files/directories in their first level?

How can I use find to generate a list of directories which contain the most numbers of files. I'd like the list to be from highest to lowest. I'd only like the listing to go 1 level deep, and I'd ...
2
votes
2answers
31 views

Search for files by content only in trunk subdirectories

I think its a simple question, but the answer is probably a little more complicated :P Edit: Actually, its not complicated at all!^^ So I have a directory with multiple svn projects and I would like ...
3
votes
3answers
447 views

Which command to use to find all files/folders with non-default permissions?

Suppose I have a folder, containing other files and folders, and I'd like to find out recursively which subfiles and subfolders have non-default permissions (i.e., not 644 or 755). Which command can ...
4
votes
2answers
132 views

In Linux Fedora, How can I select files to move by time interval

How can I select and move files that were written in a specified time interval, such as 1530 to 1730 local time on a recent date? Background: I use Linux Fedora 12, and I have made my first, and long ...
-1
votes
4answers
113 views

Need a command sequence that will move files from one directory to another based on a particular year? [duplicate]

I'm looking for a sequence of commands (one liner would be ideal) which will identify all the files created in particular year, and move the resulting files to another directory.
2
votes
1answer
100 views

How to FILTER the files with filename and then DELETE the OLDEST file from there? [duplicate]

I create and keep the following automated backup files e.g.: fruits_29-12-2013.gz fruits_30-12-2013.gz fruits_31-12-2013.gz sweets_01-12-2013.gz sweets_02-12-2013.gz sweets_03-12-2013.gz .. ...
4
votes
2answers
8k views

Remove all files created before a certain date

I have a directory containing a high number of files (like logs for every day of the year). I would like to remove all files created before let's say 22/11. How can I achieve that ? Must I use find ...
4
votes
2answers
411 views

Find file names that don't contain a specified string

I'd like to execute the opposite of: find . -name "*2013*" Find all the files in the current directory that don't contain the string "2013" in their names. How can I do that?
0
votes
2answers
107 views

How can I for example list five largest files in /usr/lib -directory?

How can I for example list five largest files in /usr/lib directory? Please also add some minor explanation for each bit of code that you are using.
0
votes
3answers
187 views

thoroughly find all links (hard and symlinks, and any combination thereof) leading to a file/dir

I read "most" of the proposed questions, but I believe they all miss the complexity of the right answer. I want, only using "basic" commands (for maximum portability) (i.e., something that would work ...
3
votes
3answers
243 views

Find directories without music files

My ~/Music/ directory is actually full of "empty" directories I want to clean. I say "empty" because this directories actually contain files, some contain old cover image files or Thumbs.db files. I ...
3
votes
5answers
408 views

Delete all files in directories except those whose path are listed in a file

Given the following files: data/A/a.txt data/B/b.pdf ... date/P/whatever.log ... data/Z/z.jpg I would like to delete all files in the data/A/, data/B/, ..., data/Z/ directories except those files ...
4
votes
1answer
757 views

How search for a file beginning with either a or z and ending with a or z?

I attempted find -name 'a*' 'z*' '*a' '*z' but it gave me the error code find: paths must precede expression: z* I know how to find files starting with a though z, or ending with a-z, but not ...
4
votes
2answers
182 views

Find and differences between -perm /6000 and -perm /u+s

I have been trying to find setuid executables using a `one liner'. The line I first tried was: find / -perm /u+s -type f Then I found a line which is similar but gives different results: find / ...
1
vote
2answers
1k views

Find and move directories based on file type and date

I have a directory "New Movies" containing 200+ subdirectories "Movie Name (year)". The subdirectories "Movie Name (year)" contains a single video file (avi/mkv) and several related jpg/xml files. I ...
4
votes
1answer
4k views

delete files matching pattern

I need to recursively remove all files in all subdirs where the filename contains a number followed by an 'x' followed by a number, at least two times. Example: I'd want to remove these files: ...
1
vote
2answers
1k views

Cheapest way to find the oldest file (recursively) from a directory under heavy load

What is the least expensive way to find the oldest file in a directory, including all directories underneath. Assume directory is backed by SAN and under heavy load. There is concern that "ls" could ...
1
vote
2answers
153 views

How can find support large files?

I would like to find all the files of my system, which sizes are more than a couple gigabits. I thought I would use find -size, but the man page states: The size does not count indirect blocks ...
2
votes
2answers
238 views

Unable to concatenate files with find ./subdir/* -print0 | sort | xargs -0 cat > merge.txt

I am trying to concatenate thousands of files that result from processing the pieces output by split with find ./subdir/* -print0 | sort | xargs -0 cat > full_merge.txt The files under subdir ...
2
votes
4answers
116 views

find command: how to ignore pathname?

I have to find some type of files in a directory and it's subdirectories and I only have to print out the filenames. So here's the main command: find -type f -name "*.c" Now, how could I cut the ...
3
votes
5answers
3k views

Find and copy directories containing file type

I have a directory "Movies" containing subdirectories "Movie Name". Each subdirectory "Movie Name" contains a movie file and related image/nfo files etc. I'm trying to copy all directories containing ...
6
votes
1answer
168 views

find is missing a result — how is that possible?

What conditions explain this output: root@ip:/# find / -name "server.xml" -print /etc/tomcat7/server.xml root@ip:/# ls /var/lib/tomcat7/conf/server.xml /var/lib/tomcat7/conf/server.xml I am ...
3
votes
3answers
193 views

file mass deletion

I would like to delete all the txt, xls,pdf files in a directory as well as its sub directories. I would like to save everything else. find . -type f ! -iname '*.xml$,.png$,.jpeg$,.gif$,' -delete ...
1
vote
4answers
3k views

Is there a command to list files, exclude sub-directories and display size and date?

Before I begin please assume I have only basic knowledge in UNIX. Basic meaning I have only started reading about it since last week for a work related purpose. I have been experimenting with the ls ...
31
votes
6answers
13k views

Howto find duplicate files on disk

Is it possible to find duplicate files on my disk which are bit to bit identical but have different file-names?
3
votes
4answers
807 views

How to count recursively for the number of files in several directories?

I have a directory, containing a lot of files and directories. I am trying to get the number of files (and directories) contained recursively in every directory. I tried the following approach: for ...
1
vote
2answers
332 views

A bunch of files have 777 permissions

I have been learning Python and Bash scripting, and I up to now I have given my scripts 777 permissions. Having learned more about how to set permissions, and knowing this is a bad idea, I ran the ...
4
votes
4answers
8k views

Move all files with a certain extension from multiple subdirectories into one directory

Suppose I have a bunch of zip files in several directories: Fol1/Fol2 Fol3 Fol4/Fol5 And I want to move them all to a common base folder. How would I do this?
2
votes
2answers
189 views

Select greatest numbered filename

Simple requirement but can't find anything online which can achieve it. I have a list of dated files as below... filename_20120101.dat filename_20120102.dat filename_20120103.dat I ...
32
votes
3answers
5k views

locate vs find: usage, pros and cons of each other

In Linux and Unix systems there are two common search commands: locate and find. What are the pros and cons of each? When one have benefits over the other?
2
votes
2answers
522 views

Sort the output of find before piping to openssh

I'm using this command to recursively generate a SHA-512 hash for each file in a directory hierarchy: find . -type f -exec openssl sha512 {} \; I'd like to sort the files in lexicographical order ...
6
votes
5answers
1k views

Find images by size: find / file / awk

I've been trying to find png image files a certain height (over 500px). I know that file will return image dimensions. Example: $ file TestImg1a.png TestImg1a.png: PNG image data, 764 x 200, ...
4
votes
2answers
506 views

List files created on Sundays

How do I list/find all the files created on Sundays or Mondays? How do I use the date parameter to display them? Something like : ls -f date + %a or find -type f | date +%A or find -type f ...
7
votes
2answers
276 views

Search MP3/Ogg files by tags/parameters from the command line

Is there any utility to search MP3/Ogg files by tags (or other characteristics) from the command line? (e.g. finding all audio files longer than 10 minutes with genre set to 'Rock'). I found this, ...