Skip to main content

All Questions

Tagged with
0 votes
1 answer
31 views

Pipe null terminated file paths twice to same output, but second time sorted by basename

So, let's say I have a script that uses find to print paths with null-terminated filenames. I also want to print another version of the output where each path is sorted by its basename. I want to ...
Eduardo Perez's user avatar
1 vote
3 answers
147 views

Detect leaf directories in Perl

For a Perl script I'm working on, I'm looking for a fast and reliable way to find all subdirectories (transitively) of a given directory which are leaves, i.e. those not having any subdirectories of ...
q.undertow's user avatar
0 votes
2 answers
529 views

while read line find – faster with perl?

I have a text file with three columns separated by tab and I read the third column line by line to find all files in a directory which have this in the name. Since it is a file with up to 1000 entries,...
spazek's user avatar
  • 27
3 votes
3 answers
4k views

Delete the oldest files in folder if combined size of folder is more than 10G

The following syntax will remove the files under hive folder: /usr/bin/find /var/log/hive -type f -print -delete I am trying to do the following: Remove the oldest files under /var/log/hive only if ...
yael's user avatar
  • 13.4k
1 vote
1 answer
365 views

Can I unlink in perl with a list from a unix find command?

Trying to delete thousands of files on multiple servers. rm will not work. Wrote a generic script to run from cron to delete on a regular basis: ... /bin/perl -e 'unlink ( <`find ${DIRECTORY} -...
Marinaio's user avatar
  • 298
0 votes
1 answer
101 views

Linux red hat + replace PATH or word on scripts

Under folder: /var/userTN/applo folder I have around ~100 shell scripts that include the following PATH: GLOBAL_PATH=/export/pop/PLW5 I want to replace the PATH on all the scripts under folder: /...
yael's user avatar
  • 1,529
2 votes
3 answers
3k views

Can I use the find command to pass arguments to perl?

I have a perl script $ cat ~/script.pl sub main { my ($file) = @_; <STUFF> } } foreach (@ARGV) { main($_); } I want to execute ~/script.pl on every .txt file under the ...
Brian Fitzpatrick's user avatar
1 vote
2 answers
2k views

is it possible to search for files that have a special Linux file attribute?

is it possible to search file in the linux OS that have particular file attribute as this: ---S--l--- ---S--l--- 1 root root 0 Mar 1004:25/opt/csTuner/iba/wys/tuer_lolk What is S in ...
maihabunash's user avatar
  • 7,181
0 votes
3 answers
5k views

Find files less than 1 week old with match TODO in files

My unsuccessful proposal find ./ -newerct '1 week ago' -print | grep TODO No output although should be. Files are text files like Lorem % TODO check this out Lorem ipsun How can you find less ...
Léo Léopold Hertz 준영's user avatar
16 votes
2 answers
18k views

find files not matching list of filename patterns

I find myself needing to find and identify extraneous files (out of about 900K files on a 2T drive). There are lots of files that I want to keep, and I have filename patterns for these known good ...
ChuckCottrill's user avatar
0 votes
1 answer
2k views

Rename files and directories with a special characters on solaris machines

The target of the following code ( commands ) is to rename files/directories and also support files/directories with a special characters as "@" or "." etc those commands are run fine on Linux ...
yael's user avatar
  • 1,325
1 vote
2 answers
19k views

How to use the find command in Perl script?

Could someone tell me why the find command always go to the root directory but not the directory that is specified in $srceDir? my $srceDir = "/mnt/SDrive/SV/Capture Data/"; my $find_cmd = 'find $...
oanh's user avatar
  • 11
0 votes
1 answer
507 views

Error trying to call find from perl

use warnings; use File::Find; my $srceDir = "//mnt/Share_Drive/Verizon PM&T/Capture Files/"; opendir(DIR, $srceDir) or die "Can't open $srceDir: $!"; my @files = (find -type f -newermt "12 Feb ...
oanh's user avatar
  • 11
2 votes
2 answers
983 views

find command for the newest 500 files in a directory tree and also be POSIX compliant

I am looking for a single line shell script or unix command to find the newest 500 files in a directory. Major constraints are it should be POSIX complaint and the directory can have tons of files.
Sandeep's user avatar
  • 21
10 votes
5 answers
6k views

Find files with same name but different content?

I want to generate a list of files that have: Same name Different content in a directory (including all children directories and content). How to do? Bash, perl, anything is fine. So, two files ...
Nicolas Raoul's user avatar

15 30 50 per page