find -exec directories with spaces


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting find -exec directories with spaces
# 29  
Old 03-16-2010
I think that was the point I was making earlier. Because of the 1990's divergence of the extant unix flavors, I don't see that knowing linux find semantics cold (or any other find implementation) is any sort of guarantee that a given semantic nuance will carry over somewhere else.

I still post ll instead of ls -l because I learned it first. Long ago. A lot of unixes do not have ll natively.
# 30  
Old 03-16-2010
@methyl: I still believe this is not technically possible but the details you are providing are interesting.

One of the reasons I was denying any possibility for the quotes to be useful is that all know shells are removing them before passing them to the find command. This is defeating any usefulness with embedded spaces in filenames as there aren't spaces yet when the command is called. As you are telling this was occurring in a crontab context, it might be possible that an exotic/early cron implementation by DRS/NX would have not used a shell to interpret the command line but simply execute the line as is. I'm not aware of such weird implementation but I'm open to that possibility. In that case, and only in that one, the single quotes would have been received by the find command. Another hurdle is that, as far as I remember, System V find (DRS/NX was SVR2/3/4 based) was only expanding the curly braces when alone as argument but that wouldn't be the case when the quotes are passed untouched. Let's assume this second objection is false because of a specific customization. All find and rm implementations are properly handling their arguments so do not need quotes anyway. The only reason where these surviving quotes would have had an effect would have been a "rm" wrapper that wouldn't properly expands its arguments, like:
Code:
#!/bin/sh
# broken rm implementation
/bin/rm $*

That's a lot of oddities for a single system ...

About experience as you are asking, in the last 26 years I have been working in various expertise positions (support, training, development, consultancy) with many Unix releases including Unix version 7 (TNIX), 4.2BSD (Utek), Minix, Ultrix, HP-UX, DG-UX, AIX, SVR3 (Utek V), Xenix, SCO, OSF/1, IRIX, SunOS 4 and 5 (Solaris) all versions and Gnu/Linux most mainstream distributions.

Of course, none of these did/do exhibit in their standard configuration the '{}' feature you are supporting.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Directories having spaces

Hi I have a list file with complete path of files and there are directories with spaces. Now when i read the list file, read the line and read the file it says no file found because of the space. How can I get through this issues for file in $(<list_file.txt) do first_line=`head -1... (8 Replies)
Discussion started by: lijjumathew
8 Replies

2. Shell Programming and Scripting

Directories with spaces

My code path=`find /root/folder/ -maxdepth 100 -type d | sort --random-sort | head -1` if this returns a directory with spaces in for instance: /root/folder/this is a folder is there a way to replace the value of path with the same value but with the spaces replaced so its... (2 Replies)
Discussion started by: digitalviking
2 Replies

3. Shell Programming and Scripting

find: missing argument to `-exec' while redirecting using find in perl

Hi Friends, Please help me to sort out this problem, I am running this in centos o/s and whenever I run this script I am getting "find: missing argument to `-exec' " but when I run the same code in the command line I didn't find any problem. I am using perl script to run this ... (2 Replies)
Discussion started by: ramkumarselvam
2 Replies

4. UNIX for Dummies Questions & Answers

Using grep command to find the pattern of text in all directories and sub-directories.

Hi all, Using grep command, i want to find the pattern of text in all directories and sub-directories. e.g: if i want to search for a pattern named "parmeter", i used the command grep -i "param" ../* is this correct? (1 Reply)
Discussion started by: vinothrajan55
1 Replies

5. UNIX for Dummies Questions & Answers

Find Exec

Hello All, Is there a way to make exec do a couple of operations on a single input from find? For example, find . -type d -exec ls -l "{}" ";" I would like to give the result of each "ls -l" in the above to a wc. Is that possible? I want to ls -l | wc -l inside... (1 Reply)
Discussion started by: prasanna1157
1 Replies

6. Shell Programming and Scripting

How to find 777 permisson is there or not for Directories and sub-directories

Hi All, I am Oracle Apps Tech guy, I have a requirement to find 777 permission is there or not for all Folders and Sub-folders Under APPL_TOP (Folder/directory) with below conditions i) the directory names should start with xx..... (like xxau,xxcfi,xxcca...etc) and exclude the directory... (11 Replies)
Discussion started by: gagan4599
11 Replies

7. Shell Programming and Scripting

Script to find folders with spaces and end of files and directories

Hi I need a script that can search through a set of directories and can locate any file or directory that has a space at the end Filename(space) Foldername(space) I then need to remove that space within the script Hope someone can help thanks in advance Treds (8 Replies)
Discussion started by: treds
8 Replies

8. Shell Programming and Scripting

find & dirname:problems with white spaces in Directories

Hi all, my problem: (little extract from my bash-script) I want to move each file (.mov) from one directory (and many Subdirectories) to another directory (only one); after moving i want to create hardlinks to the old directories. Thatīs no problem, but now: source-directories... (4 Replies)
Discussion started by: tubian
4 Replies

9. Shell Programming and Scripting

Directories with spaces in name - looking for help with questions in that issue

I need to work with 'nice' directory names which have some spaces in name, and that brings some questions and not-understanding. Would some expert help me out how to deal with that?! My task is to document some processing, running from some script. I do need to have spaces in directories... (2 Replies)
Discussion started by: alex_5161
2 Replies

10. UNIX for Advanced & Expert Users

find and exec

Hi, Happy new year. Would you be so kind to explain me what does this instruction : find /rep/app -type l -exec ls -l {} \;> allink.lst Many thanks. (2 Replies)
Discussion started by: big123456
2 Replies
Login or Register to Ask a Question