By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,773 Members | 1,724 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,773 IT Pros & Developers. It's quick & easy.

File::Find package

P: 296
File::Find traverses a network folder also.

If I give \\ipaddress\dir it works but not when \\ipaddress .

How to make it traverse all the shared folders of a machine by inputting the IPAddress only?
Nov 12 '09 #1
Share this Question
Share on Google+
5 Replies

P: 53
I don't know, but isn't it possible to put the directories of \\ipaddress in a list and then do a find in that list?

But I don't know if this works (just starting with Perl):
Expand|Select|Wrap|Line Numbers
  1. my $homedir = "\\\\ipaddress";
  2. opendir (IMD, $homedir) or die "Couldn't find dir: IMD ($!)";
  3. my @thefiles= readdir(IMD);
  4. closedir(IMD);
Nov 12 '09 #2

Expert Mod 100+
P: 589
You can't

A unc path is \\server(name or ip)\sharename\dir where dir is optional

Without the sharename the unc path is incomplete and can not be searched.
Nov 12 '09 #3

P: 296

When I give the UNC path with only the IPADDRESS in the "run" box and press the enter button it shows all the shared folders.
Nov 13 '09 #4

P: 296

No it doesn't work if we give only the IPADDRESS.
Nov 13 '09 #5

Expert Mod 100+
P: 589
That's because the "run box" is a Windows application which, when given a partial unc path, "knows" that it needs to make calls to 1 or more dll functions that can get the list of share names.

Try doing it from the command line.
Expand|Select|Wrap|Line Numbers
  1. C:\>dir \\
  2. The filename, directory name, or volume label syntax is incorrect.
  4. C:\>dir \\\c$
  5.  Volume in drive \\\c$ has no label.
  6.  Volume Serial Number is 3019-C2D7
  8.  Directory of \\\c$
  10. 02/11/2009  01:49 PM            18,791 021scan.txt
  11. 02/11/2009  10:20 AM            19,141 021scan.txt.bak
  12. ...
  13. ...
If you want, you could use Win32::API to call the dll functions that return the list of shares, however that's not as easy as you might think.
Nov 13 '09 #6

Post your reply

Sign in to post your reply or Sign up for a free account.