Connecting Tech Pros Worldwide Forums | Help | Site Map

Check whether the unzip folder contains .swf files

Newbie
 
Join Date: Oct 2007
Posts: 19
#1: Mar 24 '09
Hello everyone,
My problem is, i am uploading a zipped file and extracting the contents and saving in a directory.How can i check whether the uploading zipped file contains only .swf files inside, before or after extraction.Please help how can i do this? Its urgent.


Thanks,
amulyab

Expert
 
Join Date: May 2007
Posts: 213
#2: Mar 24 '09

re: Check whether the unzip folder contains .swf files


After extraction, you can read all the filenames in the directory and determine the extensions. For example, use Dir[directory_path] to get the filenames.
Newbie
 
Join Date: Oct 2007
Posts: 19
#3: Apr 10 '09

re: Check whether the unzip folder contains .swf files


Quote:

Originally Posted by improvcornartist View Post

After extraction, you can read all the filenames in the directory and determine the extensions. For example, use Dir[directory_path] to get the filenames.

Thanks.I can get all the filename inside the directory by using Dir[path].But can you tell me please how can i read all the filenames inside and compare it with filename i want and display an error message if it is not present in the directory.Its urgent.
Expert
 
Join Date: May 2007
Posts: 213
#4: Apr 11 '09

re: Check whether the unzip folder contains .swf files


Dir[path] returns an array of filenames, so you should be able to search the array for the filename you want. For instance, you could use Dir[path].include?(filename).
Reply