Tagged Questions
2
votes
3answers
135 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
...
17
votes
4answers
685 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?
6
votes
1answer
113 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 ...
1
vote
4answers
126 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 ...
2
votes
4answers
102 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 ...
7
votes
3answers
2k views
Getting size with du of files only
How can I get the size of all files and all files in its subdirectories using the du command.
I am trying the following command to get the size of all files (and files in subdirectories)
find . ...
1
vote
2answers
103 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 ...
2
votes
4answers
251 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
55 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 ...
13
votes
3answers
596 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
103 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 ...
10
votes
1answer
3k views
How to skip “permission denied” errors when running find in Linux? [duplicate]
Possible Duplicate:
How do I remove “permission denied” printout statements from the find program?
When I run this command in Linux (SuSE):
find / -name ant
I get many error ...
1
vote
3answers
187 views
Merging files into one also adding a new line between each file
I'm using
find . -type f \( -name "*.js" ! -name "*-min*" \) -exec cat {} \; > all.js
to merge files together. Unfortunately I don't get a new line after each file but it ends and the new file ...
6
votes
4answers
279 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, ...
3
votes
2answers
186 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 ...