in reply to size and exist doesnot work with UNC folders/dir
Sometimes we write code because we don't know about modules; sometimes we write code because we have trouble using modules; sometimes we write code because we want to understand how something works. The questions arising from the do-it-yourself approach are, in my humble but arrogant opinion, still valid.
That said, to answer your specific questions, three things are needed:
Here's what I get when I run your code:
C:\Steve\Dev\PerlMonks\P-2013-10-17@1130-FileSize>testfsize.pl Global symbol "$directoryUNC" requires explicit package name at C:\Ste +ve\Dev\PerlMonks\P-2013-10-17@1130-FileSize\testfsize.pl line 9. Global symbol "$len" requires explicit package name at C:\Steve\Dev\Pe +rlMonks\P-2013-10-17@1130-FileSize\testfsize.pl line 10. Global symbol "$directoryUNC" requires explicit package name at C:\Ste +ve\Dev\PerlMonks\P-2013-10-17@1130-FileSize\testfsize.pl line 10. Global symbol "$directoryshort" requires explicit package name at C:\S +teve\Dev\PerlMonks\P-2013-10-17@1130-FileSize\testfsize.pl line 11. Global symbol "$directoryUNC" requires explicit package name at C:\Ste +ve\Dev\PerlMonks\P-2013-10-17@1130-FileSize\testfsize.pl line 11. Global symbol "$directoryshort" requires explicit package name at C:\S +teve\Dev\PerlMonks\P-2013-10-17@1130-FileSize\testfsize.pl line 12. Global symbol "$directoryshort" requires explicit package name at C:\S +teve\Dev\PerlMonks\P-2013-10-17@1130-FileSize\testfsize.pl line 13. Global symbol "$directoryshort" requires explicit package name at C:\S +teve\Dev\PerlMonks\P-2013-10-17@1130-FileSize\testfsize.pl line 13. Global symbol "$FolderName" requires explicit package name at C:\Steve +\Dev\PerlMonks\P-2013-10-17@1130-FileSize\testfsize.pl line 14. Global symbol "$FolderName" requires explicit package name at C:\Steve +\Dev\PerlMonks\P-2013-10-17@1130-FileSize\testfsize.pl line 15. Global symbol "$fileSize" requires explicit package name at C:\Steve\D +ev\PerlMonks\P-2013-10-17@1130-FileSize\testfsize.pl line 17. Global symbol "$fileSize" requires explicit package name at C:\Steve\D +ev\PerlMonks\P-2013-10-17@1130-FileSize\testfsize.pl line 18. Execution of C:\Steve\Dev\PerlMonks\P-2013-10-17@1130-FileSize\testfsi +ze.pl aborted due to compilation errors.
If your problem is you don't know how to fix these errors, then that should be the question you are asking.
Until these are fixed, there's no point in trying to see if maybe your code has a logic error -- it's not even storing the data correctly.
Let's get the code to a state where it runs without complaints from the perl compiler, and then we can pursue any remaining malfunctions.
Hint:
Every Perl script should have start like this (or variations on the theme):#!/usr/bin/perl use strict; use warnings;
Get perl to quit barking at you first. Then ask the humans (or the Monks :-)) for help.
|
|---|