Sponsored Content
Full Discussion: Puzzled by Find
Operating Systems OS X (Apple) Puzzled by Find Post 302584336 by Denrael on Thursday 22nd of December 2011 09:20:53 PM
Old 12-22-2011
Question Puzzled by Find

I'm new to playing with the command line on OS X and am puzzled by the response I am getting from the find command. I have a file structure similar to the following

/Volumes/
../Drobo/
../../Pictures/
../../../Image 1/
../../../../Image 1.jpg
../../../../Previews/
../../../../../Image 1.jpg
../../../Image 2/
../../../../Image 2.jpg
../../../../Previews/
../../../../../Image 2.jpg

and so on for hundreds or in some cases thousands of directories at the image level. I am trying to pull all of the jpg files that are under the main group to the Pictures/ level without having them overwritten by any of the same name files from the Previews/ directories. To do this, I've set up the following two commands:

find "$PWD" -type d -iname "Previews" -exec rm -R {} \;
find "$PWD" -type f -iname "*.jpg" -exec mv {} . \;

which I execute from the Pictures/ directory level. It works, but a few things puzzle me.

1. This only works if I use the $PWD variable. If I use a . there, the rm command fails.

2. I have to use the -exec rm to succeed. If I try using the -delete flag on the first command, it fails.

3. Even though the Previews/ directories are being deleted, I receive the following error message on the terminal:

find: /Volumes/Drobo/Pictures/Image 1/Previews: No such file or directory

Anyway, I'm looking for any hints as to answers to my three areas of confusion above, and/or an easier way to accomplish the task. As I say, it's all working, so I'm just trying to understand what i'm seeing.

Thanks, this looks like a wonderful board.
 

9 More Discussions You Might Find Interesting

1. Programming

Puzzled with user ID.

I hava been reading AUPE these days. I really am puzzled with the presentation of real user(group) ID, effective user(group) ID. How do they effect on the execution of process? What's the relationship between them? Appreciate your help. (4 Replies)
Discussion started by: lethefe
4 Replies

2. Shell Programming and Scripting

command find returned bash: /usr/bin/find: Argument list too long

Hello, I create a file touch 1201093003 fichcomp and inside a repertory (which hava a lot of files) I want to list all files created before this file : find *.* \! -maxdepth 1 - newer fichcomp but this command returned bash: /usr/bin/find: Argument list too long but i make a filter all... (1 Reply)
Discussion started by: yacsil
1 Replies

3. Programming

C++ Puzzled !!

#include <iostream.h> class A { public: void f(void) { cout << "hello world \n" ; } }; void main() { A *a; a = 0 ; a->f(); // OOPs...Am I mad? What am I going to do ? } (1 Reply)
Discussion started by: RipClaw
1 Replies

4. Solaris

puzzled with VxVM and iostat..

Hi all, One disk on my root disk group failed in Veritas Volume manager. I replaced it with new one, initialized it and placed it with removed one. it Synchronized plexes and everything is fine. this node was second standby node of Sun cluster. yesterday I had failure on active node with boot... (1 Reply)
Discussion started by: samar
1 Replies

5. Solaris

Puzzled over over the relationship between the partition and geometry of hard disk.

Not sure why solaris couldn't detect the geometry of a hard disk which has a working OS of winxp pro. Is it due to the different OS that the partition information is stored in different location? When I type '"format" it is shown as below, c3d1 < drive type unknown>... (5 Replies)
Discussion started by: just.srad
5 Replies

6. Shell Programming and Scripting

Puzzled with hexdump, hd and ln

How to create a symbolic link to a command with certain argument? When I man hexdump, it is said in the man page that "-C Canonical hex+ASCII display...Calling the command hd implies this option". Actually it is. hd equals to hexdump -C. And then I examined the ln command but find it is a... (5 Replies)
Discussion started by: vistastar
5 Replies

7. Shell Programming and Scripting

How to use grep & find command to find references to a particular file

Hi all , I'm new to unix I have a checked project , there exists a file called xxx.config . now my task is to find all the files in the checked out project which references to this xxx.config file. how do i use grep or find command . (2 Replies)
Discussion started by: Gangam
2 Replies

8. Shell Programming and Scripting

How to find a file with a specific pattern for current sysdate & upon find email the details?

I need assistance with following requirement, I am new to Unix. I want to do the following task but stuck with file creation date(sysdate) Following is the requirement I need to create a script that will read the abc/xyz/klm folder and look for *.err files for that day’s date and then send an... (4 Replies)
Discussion started by: PreetArul
4 Replies

9. Programming

Serioulsy puzzled here.

Facebook had a mathematics problem which was as thus:- 6/2(1+2) = ? Answer is 9. My ancient Casio FX 730P mini computer written exactly as that gives 'error' only. Now take a look at shell versions, and a python version:- Last login: Wed Sep 14 18:04:04 on ttys000 AMIGA:barrywalker~>... (6 Replies)
Discussion started by: wisecracker
6 Replies
Image::EXIF(3pm)                                        User Contributed Perl Documentation                                       Image::EXIF(3pm)

NAME
Image::EXIF - Perl extension for exif library SYNOPSIS
use Image::EXIF; use Data::Dumper; my $exif = Image::EXIF->new($file_name); # or: my $exif = Image::EXIF->new; $exif->file_name($file_name); my $image_info = $exif->get_image_info(); # hash reference my $camera_info = $exif->get_camera_info(); # hash reference my $other_info = $exif->get_other_info(); # hash reference my $point_shoot_info = $exif->get_point_shoot_info(); # hash reference my $unknown_info = $exif->get_unknown_info(); # hash reference my $all_info = $exif->get_all_info(); # hash reference print Dumper($all_info); DESCRIPTION
Perl package Image::EXIF based on exiftags by Eric M. Johnston: <http://johnst.org/sw/exiftags/>. AUTHORS
o Aaron Crane <arc@cpan.org> (current maintainer) o sergey s prozhogin <ccpro@rrelaxo.org.ru> REPORTING BUGS
Please report bugs at either of the following locations: o https://rt.cpan.org/Public/Dist/Display.html?Name=Image-EXIF <https://rt.cpan.org/Public/Dist/Display.html?Name=Image-EXIF> o https://github.com/arc/p5-image-exif <https://github.com/arc/p5-image-exif> SEE ALSO
exiftags. perl v5.14.2 2012-05-11 Image::EXIF(3pm)
All times are GMT -4. The time now is 01:51 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy