Logging file/dir listings to file (qx)

TheHiveMind

Banned
Joined
Jul 25, 2008
Messages
5,073
Reaction score
4
Location
The Big Wide World
Hi, Im using a linux query (ls) inside a perl script.

system("cd $Dir");
my @arr = qx 'ls -s -lg -R -I Progs 2>/dev/null';

What this query does is go through the current dir (which is specified in args), and sub directories, returning the file/dir listing and details to the array, while NOT printing it to screen. -I means IGNORE. So in the above query It will ignore all files or dirs called Progs. I have checked the Man page and I cannot seem to find out how I could possibly ignore multiple arguments???? Seems that it only accepts one argument, however I have a few extremely large directories I would like to skip and don't need to include. Does anyone have any ideas about how I could do this without having to program the recursive functioning all by myself and executing the query for each directory? Also im not entirely sure that would work either in a case where there are two directories i want to ignore inside a specific directory..

Please note::Simply not logging certain things to file would be easy, however I would like the ls command to ignore them completely, seeing as though when I use ls on some of the larger directories, to print to screen, it freezes my netterm session because the listing is just too large. Im afraid of that happening in this case too which is why I am asking.

We are porting our system over to a new machine. I would like to double check that all the relevant files and directories were copied over, with permissions intact, and I will check the file sizes too to see if we have updated anything since then on the old server etc. I will log the file structures to file and compare the 2 files created to determine differences.

TIA
 
Last edited:
Regarding ignoring multiple patterns with ls, have you tried "--ignore=blah1 --ignore=blah2"? From your post I get the impression that the directories you want to ignore are known targets and minimal in number.
 
Top
Sign up to the MyBroadband newsletter
X