Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Testing and copying

Status
Not open for further replies.

womp

Technical User
Apr 6, 2001
105
US
Hello,
I am going through a large web file. Separating files from
directories. Then I wish to check the permissions and ownership on each file/directory.

I have started this script:

#!/usr/bin/perl -w

use File::Copy;

$dirs="";
$files="";

@array=qx(ls -R /web/);

foreach $files(@array) {
chop($files);
if(-f $files) {
qx(cat $files >> /tmp/files);
} else {
qx(cat $files >> /dirs);
}
}

obvisiouly I am not doing this right. In the above piece
I am just trying to test if a name from the array is a file
or directory. If it is a file I put it in one file and directory in another. What am I doing wrong???
 
Try a shell script. The following code is untested. It's been awhile since I've last used *nix, so the syntax may be off.
Code:
#! /bin/bash

find /web/ -type f -print >> /tmp/files
find /web/ -type d -print >> /tmp/dirs
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top