Questions tagged [find]

search for files in a directory hierarchy

Find is used to look files in a directory hierarchy. You can refer to its manpage here.

Examples:

Look for all files on a server owned by user siegfried:

 find / -user siegfried

Find all files ending in php en remove them:

 find / *.php -exec rm '{}' \;
314 questions
0
votes
1 answer

Issue with rsync -R wrapped in a find command

I'm trying to copy all the files named 'specials.xml' in the current and all subdirs, and also create the name of each sub-directory. I'm using -R to rsync so it creates the relative paths for each corresponding subdirecotry. For example, I want…
user40696
  • 113
  • 5
0
votes
1 answer

Reverse and modify copy file to all subfolders command, xargs

i found this online it copy file to every sub folder on the current dir for full tree depth find -maxdepth 1 -type d -print0 | xargs -0 -n1 cp -v .htaccess now would be nice if it could ask if the file already exist or at least overwrite if file…
JohnA
  • 101
0
votes
5 answers

search files based on text file containing list of files

I have a text file containing file names only (it does not contain their paths). I need to find these files which may lie in any of the subfolders and then copy or move them to other location. To find the files I have tried cat 1.txt | xargs find…
Prasad
  • 1
0
votes
2 answers

Running expand on a set of files

I'm trying to run the expand shell command on all files found by a find command. I've tried -exec and xargs but both failed. Can anyone explain me why? I'm on a mac for the record. find . -name "*.php" -exec expand -t 4 {} > {} \; This just creates…
ChrisR
  • 262
  • 3
  • 13
0
votes
3 answers

can not find a directory with find command

I tried using the command sudo find / -type d -iname firefox It gave me the following output /usr/share/doc/firefox /usr/lib/firefox /home/ashu/.mozilla/firefox /etc/firefox But i have a directory named firefox located at…
Bunny Rabbit
  • 103
  • 2
0
votes
2 answers

find command to find php files but exclude a certain directory

How do I run a find command to find php files but I exclude a folder i.e. /usr/local/bin?
edotan
  • 1,876
  • 13
  • 39
  • 57
0
votes
2 answers

How to find mail on shared linux hosting and delete after forwarding

I'm forwarding mail from a shared hosting account to a gmail address. The mail forwarder does not delete the mail after forwarding so the directory is getting full. I tried the following in a cron job, but it only seems to delete one file at a…
LandedGently
  • 115
  • 3
0
votes
1 answer

How does find command sort results?

I have an old messy shell script. One of the steps executes find command with some parameters and expects the results to be sorted by creation time. It works well on old machines (find version is 4.1.7). On newer machines the results of find are not…
Muxecoid
  • 125
  • 4
0
votes
2 answers

Looping in a directory to find a folder and delete

I use Dreamweaver to upload the web page to my site, it bring a folder called _note to everywhere in my site. I would like to ask how can I loop in the directory(/home/user/htdocs) to find the folder _note and delete it?
Charles Yeung
  • 115
  • 1
  • 7
0
votes
3 answers

List all files added/modified on date

How can I use the find command to list all files for example modified on april 9 2011. Thank you, Chris
Chris Muench
  • 487
  • 3
  • 10
  • 31
0
votes
5 answers

Find all files recursively by a certain date

My site is compromised by an FTP brute attack and the cracker modified / created some files in my home directory. Let's say the date of the malicious creation / modification is 2011-4-5 21:38:09. How can I find other files in public_html that is…
datasn.io
  • 279
  • 1
  • 5
  • 16
0
votes
4 answers

how to find a text string which may be present in some unknown file in entire filesystem

I am stuck up with a problem I have a line 'something' in some file. In which file is this line that I have forgotten. In the entire root file system I would like to find out which file and where is this line. So how can I go for this.I have used…
Registered User
  • 1,463
  • 5
  • 18
  • 37
0
votes
2 answers

rename files and dirs under linux

why the following command " find / -name 'node1' -print0 | xargs -0 rename 's/node1/node_STAR/' " not replace the node1 under /var/tmp directory? my target is to scan linux sys and rename directories and files example from my linux…
yael
  • 1,389
  • 4
  • 14
  • 13
0
votes
2 answers

Search multiple strings from multiple files

How to search multiple strings from multiple files with a single command. May be using grep or find or if there is any other in Linux or Solaris
Ramesh Kumar
  • 1,770
  • 5
  • 19
  • 29
0
votes
3 answers

exclude all hidden files and directories in solaris

Unix newbie could use your help. I'm using Solaris 10 and need to find all files, excluding all hidden files and directories. The ultimate goal is to put this in a script that will delete files 60+ days old on a server. I tried: find . ! ( -name…
anurag kohli
  • 57
  • 1
  • 2
  • 7