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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

comparing filenames in directory with filenames in a file

Status
Not open for further replies.

siswjh

MIS
Dec 6, 2001
63
0
0
US
What I want to do is open a directory read the filenames in that directory and compare them to a file that has all the names of the files from the directory. When it finds files in the directory that are new ie. not in the file holding the filename, copy them to staging directory and update the file holding the filenames.
 
The following functions may help you

# This function opens the directory for reading
opendir(DIR,"$YOUR_DIR")

# This function should give you all the files in the directory
@ListOfFile = readdir DIR;

#This function closes the directory
closedir(DATA);

You can read the list of files you have in the text file into a array and compare that array with the one above (@ListOfFile)

Hope this helps you.

- V
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top