× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi Rob,

rob@xxxxxxxxx wrote:
Ok, so we got the beginning of this
/FTP/GDI/EQUIPMENTVENDORS/FROMGDI/GermanyAssyLine/IRT - Walldurn.avi
being truncated to
./GDI/EQUIPMENTVENDORS/FROMGDI/GermanyAssyLine/IRT
figured out. We now still have two problems.

1 - Why did the end get truncated? Is ls or awk not handling spaces and whatnot in the file name? If so, what's the workaround?

Generally speaking, Unix uses a space to delimit parameters on a command-line. I suspect you have something like this:

find / -type f -size +40000 -exec ls -l {} \;

Each time it finds a file that's greater than 40000 blocks (20 MB) it'll start a new background job, and run the following command in that background job:

ls -l /FTP/GDI/EQUIPMENTVENDORS/FROMGDI/GermanyAssyLine/IRT - Walldurn.avi

The problem with that is that the "ls" program is actually receiving 4 parameters (not 2 as you intended).

parm1 = -l
parm2=/FTP/GDI/EQUIPMENTVENDORS/FROMGDI/GermanyAssyLine/IRT
parm3=-
parm4=Walldurn.avi

So it's trying to list three different files (one named IRT, one named -, and one named Walldurn.avi) and it can't find them, thus the problem.

I don't understand why you're running "ls" from "find". Why not simply pass the -ls switch to find, so that it doesn't have to spawn a background job at all? Or doesn't the -ls option give you the data you want? i.e., why not do this?

find / -type f -size +40000 -ls

Look at the manual for "find", and you'll see that -ls is an option available, and it'll explain what kind of output you should expect. (vs. running the ls command separately)

If you do want to execute the ls command in a separate process (I would try to avoid that, personally), just put the filename in quotes so the spaces won't be seen as parameter delimiters

find / -type f -size +40000 -exec ls -l "{}" \;

2 - Why did the dates get formatted sporadically?
Mar/04/2008
Jun/02/04:44

The long option (-l) of the ls command is not really intended to be processed by a script. The date that's output is intended for a human being.

For example, let's say two humans are talking (you & I) if I wanted to tell you "I ran the cleanup procedure on May 31st, 2009" I probably wouldn't say "May 31 2009", instead I'd probably say "I ran the cleanup procedure on Sunday".

ls does the same sort of thing, to a degree. If it has been less than a year since the date, it'll simply say the month, day and time (May 31 14:16) and not list the year, to save space. If it has been more than a year, it'll list the year rather than the time "May 27 2007". Don't expect the date format to be consistent, it's not intended to be.

If you like, I wrote a UDTF that returns the IFS filenames along with attributes like dates, sizes, etc. The advantage to the UDTF is that the output will be in a consistent format that should be easy to work with (it uses the APIs rather than QShell) You can get it here:
http://systeminetwork.com/article/udtf-recursive-ifs-directories

With that, it should be an easy SQL statement:

Select t.Pathname, t.size, date(t.change_time)
from table(ifstree('/')) as t
where size > 20000000

Don't get me wrong the shell script method should work if you put enough effort into it, I just think this way might be a little easier for you.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.