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

Finding/deleting top level folders not containing any files

I want to delete the top level directory which does not contain any files, but can contain other empty (meaning again not containing files) directories. For example: $ ls -R .: foo/ ./foo/: bar bar1 ./foo/bar/: ./foo/bar1/: Here, I would like to…
skinp
  • 749
  • 1
  • 7
  • 19
0
votes
2 answers

Copying files (of a particular extension) remotely onto local computer preserving paths

I have bunch of files on the remote server. I'm not interested in most of them, except for .pl files. I want to get a copy of these on my local computer. What is the best way to do this (at the same try preserving its path)? I'm thinking somewhere…
denormalizer
  • 491
  • 2
  • 5
  • 15
0
votes
1 answer

List all files without 775 or 777 permissions

How can I list all files without 777 or 775 file permissions?
Ben
  • 3,800
  • 18
  • 65
  • 96
0
votes
2 answers

File name using find

How to get the file name while using find command? When I use find command to search particular type of files from a directory and subdirectories, I get the whole path of that file, how do I get the file name only? The problem I am facing is when I…
yogsma
  • 245
  • 1
  • 3
  • 12
0
votes
1 answer

Untar multiple files in different directories

am trying to perform an update on multiple site that use an open source CMS but untaring a patch file in each sites httpdocs directory. My plan was to perform a find for the patch file then untar using the following command: find . -name…
wildeep
  • 3
  • 2
0
votes
3 answers

Scripts help FIND command via atime output to multiple files

here is a script I have wrote that I need help with. in the script I do a find for any file that has not been access for over 30 days, 60, 90, 180, 270 & 365 days. This works just fine. however, this takes a few days just to finish the 30 day…
user41612
  • 11
  • 2
0
votes
0 answers

Find directories not containing subdirectories with today file date

Can you please help me with a bash string for finding and listing only parent directories NOT containing subdirectories with today file date, so i can delete them recursively? My Env is CentOS and dir structure like…
Cepxuo
  • 1
0
votes
1 answer

$'\r': command not found error when executing find in a bash script

I wrote the following script; it's modified for simplicity and privacy…
MaestroMaus
  • 115
  • 4
0
votes
0 answers

RHEL 9 server with cloned disk unable to find logical volume after boot

We have an RHEL 9 server. We cloned it's disk drive to a new disk. (dd if=/dev/olddrive of=/dev/newdrive bs=4096) It has a couple LVM partitions (as shown on /etc/fstab on the cloned disk): However when booting from the new disk, we got an…
ServerMan
  • 15
  • 4
0
votes
1 answer

searching for multiple files, but if one file is missing I want to know from the output + find

$ find ./ -name "AABE*" ## this returns nothing $ echo $? 0 $ find ./ -name "AWGT*" ## this returns locations of were files matching the…
HattrickNZ
  • 103
  • 4
0
votes
1 answer

Linux find command to return files AND owner of files NOT owned by specified user

I have the following terminal command: find /home/not_this/ \! -user not_this_user_account The goal is to find all the files and directories not owned by the specified user and this version of the find command works great. However I'd really like…
John
  • 134
  • 10
0
votes
0 answers

How to rsync files/folder from some days ago?

I would like to run cron job that run rsync command to copy files from 3-4 days ago, I've already try some rsync command like this: rsync -arogzv --ignore-existing --files-from=<(find . -type f,d -mtime +2 ) --exclude={'some_files'} /source…
0
votes
1 answer

Failing string replacement in xargs command

I am trying to automatically create symlinks to directories and to replace a certain text string (foo) of the original name in the link name (bar). The name of the target directories may contain spaces (e.g. "foo with whitespace"). This is a minimal…
0
votes
1 answer

Where to find the website folder in ubuntu server?

So someone gave me the task to find where is the website code exist on ubuntu server when I look at the the index.html file path it is /var/www/example.com/html but when I go to /var/www directory I am not able to find example.com folder. Can anyone…
adnan ijaz
  • 1
  • 1
  • 1
0
votes
0 answers

locate all nested war/jar files inside jboss/wildfly - log4j

I want to detect all nested wars and jars containing the log4j library. I have jboss/wildfly services. I started to find out with 'locate | grep', but it shows me only tmp directories, not exactly war/jar files, for example…
grU
  • 1
  • 1