0
votes
3answers
29 views

How to list file names on Windows as the Unix find command?

I'm looking for an equivalent command line on Windows to the following Unix command: find test -name '*.txt' -print This command lists every filename which is in the 'test' folder and subfolders, ...
0
votes
2answers
26 views

linux: how to show permission of files (like ls -l) does on files returned by the find command

I am doing a find command to show me the files of a specific extension, like: find $directory -type f -name "*.vm" however I would like to be able to see the file permissions as well (like ls -l ...
0
votes
1answer
41 views

how to find all files under directory different directories

How can you find files name 'xyz' under directories name 'abc'? something like this....but its not working. find . -type d -name 'abc' -exec find {} -type f -name 'xyz' \; find . -not -path 'abc' ...
0
votes
1answer
65 views

Direct errors in find to /dev/null by default

On my OSX command line, find directs errors to STDOUT. I find this very inconvenient, and I also find it annoying to add 2>/dev/null to the end of the command every time. This brings up several ...
0
votes
1answer
43 views

How to use find to fill in variable in Shell script

I am making simple Shell script form some boring-ever-repeating job. Script changes directory correctly, and now I want to run other scripts based on argument I typed when running script. Other ...
4
votes
3answers
89 views

Using Unix's find command to find directories matching name but not subdirectories with same name

Edited: I mistakenly misrepresented my problem. A more accurate example now appears below. I'd like to recursively walk all directories inside a target directory, and stop each recursive call after ...
0
votes
1answer
32 views

Two ways - two different results

I ran two seperate commands each one produced a different number. Can anyone help me figure out why? find -type d -name *log* | du -hcs find . -type d -name '*log*' -print0 | xargs -0 du -hcs
0
votes
1answer
93 views

Find and delete line in .htaccess file

I am trying to figure out how could possible a command do search and delete line from .htaccess file . the following line is the line i want to search and delete RedirectMatch ...
0
votes
3answers
62 views

How to exec two commands in one find

I would like to find specific folders echo their name ls -l their contents My problem is that I don't know how to combine an echo {} and an ls -l {} in one find command. line for echo: sudo ...
2
votes
1answer
82 views

*nix find -type flag: can it accept multiple types?

I want to use find for getting all simlinks and regular files. I can use the -type for these individually, and I can use -o to string them together, but I apparently can't do -type fl. Is there a way ...
0
votes
1answer
54 views

How to find and copy files with spaces?

I am trying to find mp3 files in any subdirectories and to copy them, for example, in the current directory. Here is the command I tried: find . -name *.mp3 -ls | gawk '{printf("cp %s .\n", $11);}' ...
1
vote
1answer
55 views

Linux find command copy found files

I have mounted an image and have used the find command to show all file types found on the image ~/mounted $ find . -type f -exec file {} \; I know how to direct the output of the command to a .txt ...
2
votes
1answer
287 views

Batch run mogrify including subdirectories

The command mogrify -format jpg *.NEF when run in a directory converts all *.NEF files to JPEGs. What I want to do is to be able to run mogrify in *.NEF files inside subdirectories as well using one ...
1
vote
2answers
1k views

find command: search for files owned by many users in one command

In Linux, is there a way to do a search for files owned by multiple users (or group(s) of users) with the "find" command? Something like this? find . -user john, akido
2
votes
1answer
282 views

Recursively delete all .exe files with the same name as the containing folder

I want to delete all .exe files in the current folder and all the sub-folders. I read that find . -name "*.exe" -exec rm -f '{}' \; will do, but I want to do the delete only if the container folder ...
4
votes
2answers
333 views

How make a compressed tar when there are too many filenames for the shell to expand on a single line?

Normally I would just do something like: tar -czf archive.tar.gz *.csv But when there are too many files in the directory for the shell to expand on a single line this doesn't work. In these cases ...
1
vote
2answers
168 views

rm -r: exclude certain subdirectories

The problem I have a directory structure, e. g. something like this (here trailing slashes represent folders): ./A ./B/A/A ./B/A/B ./B/B/ ./B/C ./C/ And I need to recursively remove everything ...
1
vote
1answer
182 views

What does “{} \;” mean in find (in Linux)?

Sometimes I see a command like find . -name * -exec ls -a {} \; I was asked to execute this. What does {} \; mean here?
0
votes
3answers
235 views

Using xargs with find

I want to exclude some directories from searching files and than run the find command to find required files. I am using below command find . -maxdepth 1 -type d | grep -E -i 'sensors' | grep -v ...
1
vote
2answers
73 views

Checking version of Applications installed in ~/Applications with unknown username

I'd like to check the version of Firefox through Apple Remote Desktop of all managed computers. I have written this, but it only checks for Firefox in /Applications /bin/cat ...
1
vote
1answer
118 views

Linux command find -print. When to I need this option?

What is the difference between: find . -name "*.txt" and find . -name "*.txt" -print ? I mean what is the use of print in find. I see that it prints the results anyway so why is this option ...
1
vote
1answer
255 views

Find command doesn't work for certain subdirectories

I just downloaded some source code from a repository and I'm trying to locate a specific file in it. For simplicity, assume that the entire project has the following directory hierarchy ...
3
votes
2answers
2k views

Efficient way to search string within file find and grep

I am searching all files containing a specific string on a filer (on an old HP-UX workstation). I do not know where the files are located in the file system (there are many directories, with hudge ...
4
votes
3answers
10k views

On Linux, how can I find all files that contain a string and delete them?

I want to delete all files that contain the string foo. How can I do this using bash in Linux?
1
vote
2answers
406 views

Finding not empty directories without subdirectories and specific sorting

I have a problem with my "homework" on studies. I have to list all not empty directories from /var and /usr, which do not have subdirectories and their owner is not root user. Also, for each ...
1
vote
2answers
3k views

How list file by range of date?

I would like to list files with 3 days years old. I found this one at stackoverflow: find . -type f -printf "%-.22T+ %M %n %-8u %-8g %8s %Tx %.8TX %p\n" | sort | cut -f 2- -d ' ' | grep 2012 But I ...
-3
votes
3answers
233 views

How to comble find and file command? [closed]

My teacher gave me a homework on combining find and file Use find and file to display all files in the /home subdirectory tree, as well as a guess at what sort of a file they are. I tried ...
6
votes
2answers
560 views

Why is the grep/-r/--include combination slower than the find/-exec/grep combination?

From my understanding, the two following commands roughly accomplish the same thing: Command 1: find -name "filename.xml" -exec grep someString {} \; Command 2: grep -r --include=filename.xml ...
0
votes
2answers
517 views

Using wildcard to find (and delete) matching files on a Linux box

I want to delete a specific config file for Awstats for every user on the box. What is the best way to delete them, and possibly, in one line? All the files are under /home and have this structure: ...
3
votes
1answer
376 views

Linux: find first result from specified search path

If I have a colon-separated path list, much like $PATH, but not neccessarily $PATH. I want to search that list for a specific file name. However, I only want the first matching path. I have ...
5
votes
4answers
2k views

Gracefully deleting files older than 30 days

I have a cache folder with minimum of 15000 files. I tried this: find cache* -mtime +30 -exec rm {} \; But this made my server load fly to the skies! Is there any faster/better solution? Or can ...
0
votes
2answers
283 views

Use test to check for condition with find and execdir option

I think I can keep my question short. Why does the following command produce no output? find /usr/share/themes -mindepth 1 -maxdepth 1 -type d -execdir test -d {}/gnome-shell \; I expected it to ...
3
votes
4answers
2k views

Finding subdirectories inside all directories with the same name

I want to run a command to: Find all directories named "inc" under a folder "X". List all the subdirectories under each "X/.../inc/". Redirect the output to a file named "list" I tried various ...
7
votes
3answers
6k views

How can I search a file by its name and partial path?

Often I have a file name and it's partial path, e.g. "content/docs/file.xml". Is there a simple way to search for that file, without manually cutting into parts its name to provide directory name ...
1
vote
2answers
324 views

List all files in a directory matching a string and copy output

I'm trying to create a series of playlists on my MP3 player, running Rockbox, by finding a file matching a string, using find /cygdrive/g/MUSIC -type f -name "Search Criteria" | ...
4
votes
1answer
199 views

Why does $ find -delete not work sometimes?

I think what I'm talking about is this part of the manpage, which is just barely too indecipherable for me: -delete ... It will not attempt to delete a filename with a ``/'' character in its ...
3
votes
1answer
522 views

How to find files that don't belong to a given user

How do I recursively search for all files or directories that do not belong to given user?
3
votes
2answers
233 views

How can I speed up a selective deep copy command in unix?

I am (ab?)using the unix 'find' command to recursively export files from a directory tree that is littered with .svn directories. This command takes a long time to run. Is there a faster way to ...
6
votes
1answer
19k views

DOS Batch file to find “new” files by date

My PC has entered an infinite BSOD loop - but I do have access to a safe-mode command prompt. I'm trying to get an idea of "what changed" that might have triggered this. e.g. I might have gotten a ...
1
vote
3answers
198 views

How can I determine whether different commands using grep, find and xargs do the same thing?

Do these three commands do the same thing? A command that uses grep. grep "a" -r . A command that uses find. find . -exec grep "a" {} \; A command that uses a grep on a find through xargs. ...
1
vote
6answers
2k views

Finding files based on date, without using `find`

I know find can do what I am looking for, but I am wondering if there is an alternative way to find files on the filesystem either created before/after a certain point, or at a certain time. ...
4
votes
2answers
962 views

Linux: use find to find text files?

Is there a way to specify to find that I only want text files (and not binary files)? Grep has an option to exclude binary files, so I thought find probably has a similar feature, but I've been unable ...
9
votes
3answers
15k views

What's the difference between the find and findstr commands in Windows?

In Windows, what are the differences between the find and findstr commands? Both seem to search for text in files: find C:\> find /? Searches for a text string in a file or files. FIND [/V] ...
2
votes
1answer
44 views

find command unpredictable behaviour?

I am working on a remote machine,the disk space on the HP-UNIX machine was 96% so I was going to reduce the disk space by zipping some "*.extract.sys" files. $find . "*extract.sys" -exec ls -lrt {} ...
1
vote
2answers
405 views

Unix, find command, and false negative

Performing a search from the current directory where this file resides, this find command finds the file. # find . page.tpl.php However, when I search from a child directory, this command, # find ...
4
votes
2answers
1k views

How to rename all files and directories in current folder?

I have a directory structure like this: ./ whatever/ foos_whatever.ext something/ foo/ 1.ext 2.ext another/ foo.ext I want to rename all files and directories that ...
6
votes
4answers
371 views

How can I use find to select users with a certain amount of disk space usage?

I want to find all users shown in the /home/ directory whose disk consumption is more than 500MB. The following command works as expected. cd /home/ && du */ -hs 68K ajay/ 902M john/ ...
2
votes
1answer
2k views

How do I use the Find command in windows command-line to match the first character only?

For example if the dir command produces something like this: > dir file1.txt file2.txt another file3.txt another file4.txt I want to be able to filter all file names that start with the letter ...
5
votes
5answers
2k views

Delete all empty folders, even with .svn folders in it

I'm trying to delete all empty folders within a directory. However, find . -type f -empty does not find anything because every folder contains a hidden .svn folder. How can I work around this?
26
votes
3answers
12k views

How do I execute multiple commands when using find?

I'm trying to run multiple commands on things I have found, how can I achieve this? find . -exec cmd1; cmd2 does not seem to work; it instead runs cmd2 after cmd1 has been executed on every file.