I wondered why you were giving it ls -l, but it didn't occur to me... Well, they're not being ordered by date because find executes ls 99,999 times for 99,999 individual files here. Sorting a list one file long just leaves you where you started.
Try '+' instead of ';', which should feed as many files into ls as it's able.
Unfortunately, if there's thousands and thousands of files, it may have to split the list into multiple chunks, so it would end up not sorted by date again.
I believe Solaris find has this feature but am not 100% positive. If it doesn't, something may have to be kludged with xargs for roughly the same effect:
This will not work if any of the filenames have spaces or quotes in them.
Your code executes ls for each file that is newer than the file named by <file_name> and if one of those files is a directory, you'll list the contents of that directory instead of the directory itself.
I think you want something like:
Note, however, that this will not work if the file name indicated by <file_name> contains any whitespace characters or if any filename older than that file has a name that starts with that name and is immediately followed by a whitespace character. I assume you can work around this limitation.
Hello.
From a script, a command for a test is use :
find /home/user_install -maxdepth 1 -type f -newer /tmp/000_skel_file_deb ! -newer /tmp/000_skel_file_end -name '.bashrc' -o -name '.profile' -o -name '.gtkrc-2.0' -o -name '.i18n' -o -name '.inputrc'
Tha command... (3 Replies)
Hi all,
I am trying to find files newer than a given file and them mv them to a new location.
So I far I have:
find . ! -newer <file_name> -exec ls -l {} \;
and
find . ! -newer <file_name> -exec mv /TEMP_LOCATION {} \;
find is not liking this.
Anyone know how to modify the last... (2 Replies)
Hi,
I have two scripts that remove files. One works fine and is coded
find -name "syst*" -mtime +1 -exec rm {} \;
The other is almost the same - only thing missing is the '\'. On that script though I keep getting:
rm syst1202.file ?
etc
Does the \ make that difference or is it a... (3 Replies)
Hi
I have a little problem with the find command in a script that I'm writing. The script should check if there are some files younger than 100 seconds and then syncronise them with rsync.
My find command:
find -type f -cmin -100 -exec rsync -a --delete directory1/ directory2/
When I... (8 Replies)
Hi People,
I have a directory full of compressed files (.Z extention)
In many of these files there is a string pattern (3800078163033)
I want to find all file names which contain this string in their text.
Regards,
Abhishek (2 Replies)
Hi There,
I have a script which finds for log files and removes them if the file has changed in the last day.
The script runs fine without errors. The log file is still there. So, I decided to print the find command and run the command outside the script. Getting "Incomplete statement"
Can you... (6 Replies)
Hi,
I'm using the following command to get a list of files on the system.
find /releases -type f -exec ls -l > /home/sebarry/list.txt '{}' \;
however, its searching a directory I don't want it to search so I know I have to use prune but I don't seem to be able to get prune and exec to work... (2 Replies)
Hi,
I'm using the following command to get a list of files on the system.
find /releases -type f -exec ls -l > /home/sebarry/list.txt '{}' \;
however, its searching a directory I don't want it to search so I know I have to use prune but I don't seem to be able to get prune and exec to work... (1 Reply)
Hi All,
i am writing a shell script in korn shell
which deletes all the files in a directory
once in every 10DAYS.
the directory has different format files.
the script has something like this;
cd /home/data/pavi
echo "Please Enter the Number of Days to search for"
read DAYS... (2 Replies)