PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Serveur - Sécurité et techniques > comp.unix.shell > Scanning for large files
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
comp.unix.shell Using and programming the Unix shell.

Scanning for large files

Réponse
 
LinkBack Outils de la discussion
Vieux 19/03/2008, 17h05   #1
laredotornado
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Scanning for large files

Hi,

I'm using sh on Fedora Linux but can easily change shells. How would
I scan a directory and all its sub-directories for PDF files larger
than 5 MB?

Thanks, - Dave
  Réponse avec citation
Vieux 19/03/2008, 17h11   #2
Icarus Sparry
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Scanning for large files

On Wed, 19 Mar 2008 09:05:59 -0700, laredotornado wrote:

> Hi,
>
> I'm using sh on Fedora Linux but can easily change shells. How would I
> scan a directory and all its sub-directories for PDF files larger than 5
> MB?
>
> Thanks, - Dave


If you belive that all pdf files have an extension of ".pdf", then

find start_directory -type f -name '*.pdf' -size +5120 -print

(fill in the correct start_directory, you can use "." for the current
drectory).

  Réponse avec citation
Vieux 19/03/2008, 17h16   #3
Luuk
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Scanning for large files

Icarus Sparry schreef:
> On Wed, 19 Mar 2008 09:05:59 -0700, laredotornado wrote:
>
>> Hi,
>>
>> I'm using sh on Fedora Linux but can easily change shells. How would I
>> scan a directory and all its sub-directories for PDF files larger than 5
>> MB?
>>
>> Thanks, - Dave

>
> If you belive that all pdf files have an extension of ".pdf", then
>
> find start_directory -type f -name '*.pdf' -size +5120 -print
>
> (fill in the correct start_directory, you can use "." for the current
> drectory).
>


and u can use:
find start_directory -type f -iname '*.pdf' -size +5120 -print

if you have *.pdf and/or *.PDF and/or *.Pdf files......

--
Luuk
  Réponse avec citation
Vieux 19/03/2008, 17h36   #4
pk
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Scanning for large files

laredotornado wrote:

> Hi,
>
> I'm using sh on Fedora Linux but can easily change shells. How would
> I scan a directory and all its sub-directories for PDF files larger
> than 5 MB?


You have GNU find, thus

find /start/dir -iname '*.pdf' -size 5M

otherwise:

find /start/dir -name '*.pdf' -size 5242880c

but the search will not be case-insensitive.

--
All the commands are tested with bash and GNU tools, so they may use
nonstandard features. I try to mention when something is nonstandard (if
I'm aware of that), but I may miss something. Corrections are welcome.
  Réponse avec citation
Vieux 19/03/2008, 17h41   #5
pk
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Scanning for large files

pk wrote:

> You have GNU find, thus
>
> find /start/dir -iname '*.pdf' -size 5M
>
> otherwise:
>
> find /start/dir -name '*.pdf' -size 5242880c


Ok, sorry but it seems today I leave out pieces without realizing it.

Add a "+" in front of each size argument.

--
All the commands are tested with bash and GNU tools, so they may use
nonstandard features. I try to mention when something is nonstandard (if
I'm aware of that), but I may miss something. Corrections are welcome.
  Réponse avec citation
Vieux 19/03/2008, 21h20   #6
Greg Russell
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Scanning for large files

On Wed, 19 Mar 2008 09:05:59 -0700, laredotornado wrote:

> I'm using sh on Fedora Linux but can easily change shells.


I sincerely doubt you're using sh on Fedora:
ls -l `which sh`

> How would I
> scan a directory and all its sub-directories for PDF files larger than 5
> MB?


The other solutions posted in this thread use the assumptions that every
filename ending with ".pdf" is a PDF file, and also that all PDF files
have such a filename. This is simply not true, as PDF files may exist
with any name whatsoever and still be PDF files, such as in a browser
cache. Use this construct instead using the desired dirname:

find dirname -type f -size +5M | xargs file | grep PDF | cut -d: -f1

It's possible to refine the find command if, for instance, your filenames
may contain spaces.

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 20h49.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,11587 seconds with 14 queries