The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
shell script to find and copy the files creted in the year 2006 to another directory manas6 Shell Programming and Scripting 2 04-01-2008 03:04 AM
need to help to find and copy to a file pujars1 UNIX for Dummies Questions & Answers 2 07-12-2007 09:56 AM
find files and copy into a directory balireddy_77 Shell Programming and Scripting 4 04-27-2007 03:38 AM
HOw to find and copy aaajohnson UNIX for Dummies Questions & Answers 1 05-18-2006 01:41 PM
Find directories not containing foo, and copy foo to them dkaplowitz Shell Programming and Scripting 6 06-29-2005 08:50 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-30-2008
jlfx jlfx is offline
Registered User
  
 

Join Date: Jan 2004
Posts: 1
Help with Find All/Copy Script

Hi Gang, I am an old unix user and just recently returned in the flavor of a Mac. I have tons of pictures in the .orf format and would like to write a script to:

Search the Hard drives for that file type
Then, depending on date, copy it to a specific folder
If there is an exact copy, only keep one

How hard is this to do? Many thanks. I am very happy to be away from MS again!
  #2 (permalink)  
Old 08-31-2008
MartyIX MartyIX is offline
Registered User
  
 

Join Date: May 2008
Posts: 68
this script should find files in tree structure $whereToFind that are less than 5 days old + copy them to $path_to_specific_folder

$path_to_specific_folder="$HOME/myPhotos";
$whereToFind="/"
find $whereToFind -type f -name "*.orf" -mtime -5 -exec cp {} $path_to_specific_folder ";"
  #3 (permalink)  
Old 08-31-2008
era era is offline Forum Advisor  
Herder of Useless Cats (On Sabbatical)
  
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,652
For avoiding duplicates, you might want to pull just the file names into a list, and generate MD5 sums of all the files in that list. If two files have the same MD5, they are identical (with a probability which is close enough to certainty for most practical purposes). Remove duplicate MD5s, then copy the remaining files. (If the file format makes it unlikely that two different files will have exactly the same size, that might be good enough, and a lot quicker than MD5 to calculate.)
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 07:02 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0