f



Re: Chained-functional notation examples? #5

On 5/7/14 at 2:44 AM, dog@gmail.com (Unknown) wrote:

>Here's a related real-live problem:
>list all files in Dir-tree:D | which are less-than daysOld:N | and
>contain "egal" in the FullPathName | and contain String:"uid" OR
>"UID"

It is not entirely clear what it is you are trying to do. There
are a couple of ways to obtain a list of files in a given directory.

First, if the directory is the current working directory, then

FileName[]

will return a list of every thing at the top level of the
directory.  But in this case, only the name of things at that
level are returned not the path name.

If the directory is a subdirectory of the current working
directory you can get a list of files in that directory with

FileNames["*", dirname]

This will return a relative path name, relative to the current
working directory.

If you want the full path name then using the last form above
with dirname specified with the full path name will give you
what you want.

I will assume the desired files are in the current working
directory and you want any file with "egal" in the path name at
any sub directory level with those assumptions the problem above
can be solved as:

Cases[
     Flatten@StringCases[
         FileNames["*",Directory[],Infinity],___~~"egal"~~___],
         _?(
             FileType[#]===File &&
            
Subtract@@(AbsoluteTime/@{Date[][[;;3]],FileDate[#][[;;3]]}/86400)>age
&&
             FindList[#,{"UID","uid"}]!={} &)]

The FileType portion filters out directories, the Subtract@@
portion computes the age of the file in days and compares that
to a specified age and the FindLIst portion looks to see if the
file contains either "UID" or "uid".

Cases checks each file for the three conditions above and only
returns a those that meet all three conditions.

Note, while this isn't a difficult thing to do in Mathematica,
if all you need to do is solve this class of problem, i.e.,
something were you need a list of files meeting a specified
criteria, Mathematica really is overkill and an expensive way to
solve this class of problem.

What Mathematica can do with files is all kinds of sophisticated
numerical analysis on the file contents, analysis that could be
very time consuming to implement in something such as Perl,
Python etc.

It makes sense to solve this class of problem within Mathematica
when you already have a license to Mathematica, are familiar
with Mathematica and solving this problem is merely a subset of
a larger problem. But it definitely does not make sense to me to
buy a license for Mathematica for just the ability to locate
files in this manner. There are far less expensive solutions for
this problem.

Another thing to consider. I've been using Mathematica since
version 1.2 and pretty much on a daily basis since version 3.0.
I consider myself quite proficient using Mathematica to solve
problems I encounter. But despite using Mathematica extensively
for quite a number of years, I do not see myself as fully
mastering Mathematica. And the level of proficiency I have
achieved was not achieved in a few days or a few weeks.
Mathematica is extremely versatile and is a very rich toolset
for solving a large variety of programs. But that versatility
comes at a price. Mathematica has what I would consider a rather
steep learning curve to climb before proficiency is achieved.


0
Bill
5/9/2014 6:08:46 AM
comp.soft-sys.math.mathematica 28821 articles. 0 followers. Follow

0 Replies
833 Views

Similar Articles

[PageSpeed] 0

Reply:

Similar Artilces:

Re: Chained-functional notation examples?
On 5/6/14 at 2:26 AM, dog@gmail.com (Unknown) wrote: >I came to 'Mathematica' via Xahlee's criticism of the ad-hoc nature >of unix-piping [functional notation]. He claims [& I believe him] >that Mathematica has a better, more consistent notation. But the >facility of PRE, IN & POST-fix alternatives, seems bad. You want >ONE way of acieving the goal. More rules just increases mental load. If you are looking for a system with one way to achieve a given goal, Mathematica isn't it. There are multiple ways of achieving a result without using dif...

Re: Chained-functional notation examples? #3
A query such as this might do what you have in mind. Here directoryname should be changed to whatever directory you want searched. Select[FileNames[("*uid*" | "*UID*"), directoryname, Infinity], ((StringMatchQ[DirectoryName[#] , "*egal*"] && Today < DayPlus[FileDate[#], 3]) &] Also there is a case sensitive switch if you want to allow strings with e.g. "uID". If you want to allow that uid only in the name and not full string Daniel Lichtblau Wolfram Research ------------------- On Tue, 06 May 2014 06:26:46 +0...

Re: Chained-functional notation examples? #2
A query such as this might do what you have in mind. Here directoryname should be changed to whatever directory you want searched. Select[FileNames[("*uid*" | "*UID*"), directoryname, Infinity], ((StringMatchQ[DirectoryName[#] , "*egal*"] && Today < DayPlus[FileDate[#], 3]) &] Also there is a case sensitive switch if you want to allow strings with e.g. "uID". If you want to allow that uid only in the name and not full string Daniel Lichtblau Wolfram Research ------------------- On Tue, 06 May 2014 06:26:46 +0...

Re: Chained-functional notation examples? #4
A query such as this might do what you have in mind. Here directoryname should be changed to whatever directory you want searched. Select[FileNames[("*uid*" | "*UID*"), directoryname, Infinity], ((StringMatchQ[DirectoryName[#] , "*egal*"] && Today < DayPlus[FileDate[#], 3]) &] Also there is a case sensitive switch if you want to allow strings with e.g. "uID". If you want to allow that uid only in the name and not full string Daniel Lichtblau Wolfram Research ------------------- On Tue, 06 May 2014 06:26:46 +0...

Chained-functional notation examples?
I came to 'Mathematica' via Xahlee's criticism of the ad-hoc nature of unix-piping [functional notation]. He claims [& I believe him] that Mathematica has a better, more consistent notation. But the facility of PRE, IN & POST-fix alternatives, seems bad. You want ONE way of acieving the goal. More rules just increases mental load. A major benefit of functional [unix-piping] programming style, is that you don't need to remember the-full-journey: you just need to remember the previous stage's output. Nor do you need to remember several names: the previous outp...

Re: Re: 3d plots in mathematica 5.0 #5
Hi David, I suppose because it is not always possible to simply parametrize the contour surfaces. David Park djmp@earthlink.net http://home.earthlink.net/~djmp/ From: David Annetts [mailto:davidannetts@aapt.net.au] Hi David, <snippage> Very nice! Begs the question as to why anyone would bother with ContourPlot3D .... Regards, Dave ...

RE: Re: Re: Suggestion: Visualization of complex functions with Mathematica
I'd like to add the ComplexAnalysis package at my web site below: This package contains complex analysis routines and complex graphics routines. There are routines that convert the regular 2D Graphics into equivalent complex forms. For example ComplexLine[{z1,z2,z3...}] takes complex numbers for the point coordinates. There are routines for producing one or two panel plots or animations of complex functions. Each panel may be one of the following plot types. 1) Cartesian/PolarSurface - Plots the surface s[f[z]] where f is a complex function and s is a real function. 2) Cartesian...

Re: Re: EUREKA Re: Types in Mathematica, a practical example
Hi David, Comments are interlaced in the text below, > -----Original Message----- > From: David Bailey [mailto:dave@Remove_Thisdbailey.co.uk] > Subject: Re: EUREKA Re: Types in Mathematica, a > practical example > > Hello, > > If you want to compute with undefined array elements, why not > use subscript elements such as Subscript[a,1,2]. Hmmm, maybe... Let's see ax := {{Subscript[ax, 1, 1], Subscript[ax, 1, 2]}, {Subscript[ax, 2, 1], Subscript[ax, 2, 2]}} is not a good idea, since evaluation of ax gives an infinite loop. (There are o...

Re: How to explain functions' linearity to Mathematica 5 ?
In the Tensorial package at my web site we use a routine called LinearBreakout. I copy the routine out here so you can use it independently. LinearBreakout::usage = "LinearBreakout[f1, \ f2,...][v1, v2,...][expr] will break out the linear \ terms of any expressions within expr that have heads \ matching the patterns fi over variables matching the \ patterns vj. Example:\n f[a x + b \ y]//LinearBreakout[f][x,y] \[Rule] a f[x] + b f[y]"; LinearBreakout[f__][vars__][expr_] := expr //. {(g : Alternatives @@ {f})[p1___, a_ + b__, p2___] :> g[p1, a, p2] + g[p1,...

Re: Bug in PowerMod function (mathematica 5.0)
Yes, I believe this was a PowerMod bug that was fixed in version 5.0.1. Bhuvanesh, Wolfram Research. ...

Re: Re: Re: Re: Newly Released Mathematica 5.1 Delivers Unmatched Performance for Handling Data
John, I was thinking of angular measurement. The following works... Needs["Miscellaneous`Units`"] Convert[(Pi/4)*Radian, �] 45 � but the following, using an approximate value, does not work because Degree immediately multiplies out undoing the conversion. Convert[1.35 Radian, �] 1.35 The ExtendUnits package at my web site fixes this but at the expense of putting a HoldForm on the degree symbol. Needs["Miscellaneous`V4ExtendUnits`"] 1.35 Radian // ToUnit[�] % // FullForm 77.3493 � Times[77.34930234266115`, HoldForm[Degree]] Since I generally...

Re: Re: Re: Re: Newly Released Mathematica 5.1 Delivers Unmatched Performance for Handling Data #2
Speaking of colors, are any of you aware of a standard color palette or utility that electronically automates conversion of a given color scheme legend to a palette viewable by students who have trichromatic or dichromatic colorblindness? For example, to such people the area below the light blue in this graph http://www.wolfram.com/products/mathematica/usersanduses/experience/images/s urna3dvolume.th.jpg might be viewed as brown instead of a continuous green-yellow-red gradient. While colors are used as teaching tools in math and geography, colorblindness (like nearsightedness) is ...

Re: Re: function of a function
On 30 Nov 2005, at 14:07, Narasimham wrote: > Jens-Peer Kuska wrote: > >> it can't work because f [0] ==1 given in your differential equation >> f ' [0]==f [1] and NDSolve[] can't find the value for >> f[1] until it has integrated the equation. > > ??? > >> The nested dependence is equivalent to an infinite >> system of ordinary differential equations and it seems to be >> hard to do this by a finte computer. > > I cannot understand this. In the following two examples the first one > works, not the second...

Re: Re: Mac OS X 10.5 - Mathematica 5.1 hangs
I have been considering making a switch from Windows XP to a Mac for a while. The arrival of Vista makes the decsion a little harder, and I have just been told that Mac Office 2008 will not include VBA which means some of my spreadsheets won't work under Leopard. I visited the Apple Mac store this past weekend to see a demo - and was a little shocked that the demo machine crashed four times in one hour. It seemed like iCal, Time Machine and iPhoto are not stable and likely to be a huge pain. I also note there is a major bug which results in lost files during copy and move operatio...

Web resources about - Re: Chained-functional notation examples? #5 - comp.soft-sys.math.mathematica

Resources last updated: 1/26/2016 11:04:04 PM