Shell to seach all .mov files in a drive


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Shell to seach all .mov files in a drive
# 1  
Old 11-28-2009
Debian Shell to seach all .mov files in a drive

I want a shell script which does:
-> search all .mov files in a drive (say e: drive) which are above 800 mb of size
-> Delete the searched .mov files which are above 800mb

Thanks,
Manoj
# 2  
Old 11-28-2009
From the man page of find:
Code:
       -name pattern
	      Base  of	file  name  (the  path	with  the  leading directories
	      removed) matches	shell  pattern	pattern.   The	metacharacters
	      (`*',  `?',  and `[]') match a `.' at the start of the base name
	      (this is a change in findutils-4.2.2; see section STANDARDS CON-
	      FORMANCE	below).  To ignore a directory and the files under it,
	      use -prune; see an example in  the  description  of  -wholename.
	      Braces  are  not	recognised  as being special, despite the fact
	      that some shells including Bash  imbue  braces  with  a  special
	      meaning  in  shell patterns.  The filename matching is performed
	      with the use of the fnmatch(3) library function.	 Don't	forget
	      to  enclose  the	pattern  in quotes in order to protect it from
	      expansion by the shell.
       -size n[cwbkMG]
	      File uses n units of space.  The following suffixes can be used:

	      `b'    for 512-byte blocks (this is the default if no suffix  is
		     used)

	      `c'    for bytes

	      `w'    for two-byte words

	      `k'    for Kilobytes (units of 1024 bytes)

	      `M'    for Megabytes (units of 1048576 bytes)

	      `G'    for Gigabytes (units of 1073741824 bytes)

	      The  size  does  not  count  indirect  blocks, but it does count
	      blocks in sparse files that are not actually allocated.  Bear in
	      mind  that the `%k' and `%b' format specifiers of -printf handle
	      sparse  files  differently.   The  `b'  suffix  always   denotes
	      512-byte	blocks and never 1 Kilobyte blocks, which is different
	      to the behaviour of -ls.
       -exec command ;
	      Execute command; true if 0 status is  returned.	All  following
	      arguments to find are taken to be arguments to the command until
	      an argument consisting of `;' is encountered.  The  string  `{}'
	      is  replaced by the current file name being processed everywhere
	      it occurs in the arguments to the command, not just in arguments
	      where  it  is alone, as in some versions of find.  Both of these
	      constructions might need to be escaped (with a `\') or quoted to
	      protect them from expansion by the shell.  See the EXAMPLES sec-
	      tion for examples of the use of the `-exec' option.  The	speci-
	      fied  command is run once for each matched file.	The command is
	      executed in the  starting  directory.    There  are  unavoidable
	      security	problems  surrounding  use  of	the  -exec option; you
	      should use the -execdir option instead.

       -exec command {} +
	      This variant of the -exec option runs the specified  command  on
	      the  selected  files, but the command line is built by appending
	      each selected file name at the end; the total number of  invoca-
	      tions  of  the  command  will  be  much  less than the number of
	      matched files.  The command line is built in much the  same  way
	      that  xargs builds its command lines.  Only one instance of '{}'
	      is allowed within the command.  The command is executed  in  the
	      starting directory.

Combining that:
Code:
find /path/to/search -name '*.mov' -size +800M -exec rm {} \;

# 3  
Old 11-29-2009
e: is a MSDOS notation not unix.
What Operating System are you running?
# 4  
Old 11-30-2009
If it is referrring to Unix FS , make use of the -xdev option.

Code:
find dir_name -name "*.mov" -type f -xdev -size +800m -exec rm -f {} \;

# 5  
Old 12-01-2009
when i executed dennis command, i got this message in linux.
find: warning: you have specified the -xdev option after a non-option argument -name, but options are not positional (-xdev affects tests specified before it as well as those specified after it). Please specify options before other arguments.


However i have not yet tried pludi's command in windows. I will reply once i do it in windows.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Copy files from one drive to another, keeping most recently modified files

Hi all, I am a bit of a beginner with shell scripting.. What I want to do is merge two drives, for example moving all data from X to Y. If a file in X doesn't exist in Y, it will be moved there. If a file in X also exists in Y, the most recently modified file will be moved to (or kept) in... (5 Replies)
Discussion started by: apocolapse
5 Replies

2. Shell Programming and Scripting

awk seach and printing a particular pattern

Hi i need a help for this. the output of a command is like below 1 /tmp/x 2.2K /tmp/y 3.2k /tmp/z 1G /tmp/a/b 2.2G /tmp/c 3.4k /tmp/d Now i need to grep for the paths which are in GB..like below 1G /tmp/a/b 2.2G /tmp/c pls suggest me, how can i... (12 Replies)
Discussion started by: kumar85shiv
12 Replies

3. Shell Programming and Scripting

Find files and seach limit with grep

Hi, I'm testing nginx-cache-purge and notice that grep searches all file content, and since the cache key is in the second line I would like to limit grep searching. This is the script I'm using: github.com/perusio/nginx-cache-purge The line I would like to change and limit grep search... (5 Replies)
Discussion started by: nfn
5 Replies

4. UNIX for Dummies Questions & Answers

Seach and Replace

Our email address is changing and I need to update 4000 htm pages. I was told I command was something like this Eg) find docs/700_799/ -name "*.htm" -type f | xargs perl -pi -e 's/\/company-information\/legal-and-regulatory/\/legal-and-regulatory/g' Is there away of not changing the date... (1 Reply)
Discussion started by: mchelle_99
1 Replies

5. UNIX for Dummies Questions & Answers

How to seach in specific directories?

Hi, How can I perform a search on parent directories and not child? I need to search and gzip files that are in /Home/Parent, but there are subdirectories under Parent ( /Home/Parent/Today). I don't want to gzip anything in the "Today" folder, just stop at the parent. There are about 50... (2 Replies)
Discussion started by: bbbngowc
2 Replies

6. Shell Programming and Scripting

using sed seach replace

Need help on using sed .. search for pattern then delete that occurance globally .. ex. <ad-number>1002877553-01</ad-number> <start-date>01/07/2009</start-date> <end-date>01/07/2009</end-date> <eps-file>c:\adpay\100298452.eps </eps-file> Want to delete this expression ---> ... (2 Replies)
Discussion started by: aveitas
2 Replies

7. Programming

Different MOV syntaxes after debugging

I was analyzing the syntax on the MOV Assembly command after debugging my c code using gdb. What I don't understand is that on some machines it shows me a MOV AL,0 and on some MOV 0,AL. I know both mean the same but what is it that differentiates the syntax? (4 Replies)
Discussion started by: Legend986
4 Replies

8. Shell Programming and Scripting

Seach for Record

Below is an example of a file with some records... each record start with P1 till the next P1. If I search for something like "4,4545:" then I want all the records with "4,4545:" to be removed from original file and copied to a temp file. P1 1,123455654444 2,7126817361873 3,2134128282828... (5 Replies)
Discussion started by: xtravel
5 Replies
Login or Register to Ask a Question