hello I have scrounged the site for a while and I think I should post my problem:
problem, I want to get the list of all files ending in .report eg "hotmail.report" so I am using "ls *.report".
if i type "ls *.report" into bash I get it no worries.
This is the code I am using:
this code gives output: writer = ls: cannot access *.report: No such file or directory.
so it isnt recognising the command *.report to mean all files ending in ".report".
Could someone please give me some suggesstions? Anything appreciated.
As Rob says, using the File class is a better way of doing this.
However if you really need to do it using ls, then the problem you are having is that it is the *nix shell that interprets the *.report part of the command, so you need to actually run a shell and pass "ls" and "*.report" as arguments to it. I'm afraid I don't know how to do this in *nix, but in Windows it would be something like
cmd /C dir *.report
I'm sure similar questions have been asked before so you might find the answer by searching or you can wait until a *nix user reads your post.
Joined: Oct 16, 2011
Hello Rob, yes I am sure there are files ending in ".report" in my current folder as running the command in bash gives me two filenames.
I'll checkout FileFilter and see if I can search for files ending in .report (because they can have any name, i need to search for the .report).
Thanks for the lead I'll try it out.