Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: how to handle the warnings in a find statement

by Corion (Patriarch)
on Dec 19, 2016 at 10:17 UTC ( [id://1178045]=note: print w/replies, xml ) Need Help??


in reply to how to handle the warnings in a find statement

The "invalid argument" errors are errors from Windows telling you that your current (non-admin) account does not have the proper permissions to access the directory.

The .android directory doesn't seem to contain drivers for your Android phone but the Android Debugging Bridge (adb) credentials. Whether you installed them or something else I don't know.

Replies are listed 'Best First'.
Re^2: how to handle the warnings in a find statement
by Aldebaran (Curate) on Dec 19, 2016 at 11:46 UTC

    Alright, yeah, I installed the debugging bridge. I really had to fight to get the drivers installed on for this windows 10 target platform. I just checked my control panel, and windows thinks I'm an administrator. The files I'm looking through belong to me: that's what makes them different from the attacking files. There's a lot of things that dos windows can't do that they used to, and the architecture of windows has been a series of demotions for DOS. Is that why windows doesn't want me to look at my own files?

        Thanks all for responses, and I have more perl reading than time, which will suit my dental cleaning appointment just fine tomorrow. I've skimmed what was posted mod one and taken what I thought most relevant for scripts moving forward. Right now, I'm drawing cpan errors with my strawberry perl install. I'm putting this output between readmore tags again along with the new source listing the way windows sees it.

        The way I see it is that I was doing alright. I believe to have cleared the cpan dependencies, but see complaints that look like things a C compiler says. Perl on windows 10 is such an odd platypus that I can't think of where C libraries are and how to remediate that.

        Update

        Source listing and errors:

        C:\Users\Fred>type virus6.pl #!/usr/bin/perl use warnings; use strict; use File::Find; use Cwd; my $current = cwd; find( \&pm_beneath, $current, ); sub pm_beneath { use File::Basename; use 5.01; my $file = $File::Find::name; my $ref_to_file = \$file; my $days = .1; #hard-coded my $basename = basename($file); return if $file =~ /.*AppData.*/; use Fcntl ':mode'; use Win32::LongPath qw(:funcs :fileattr); # get object testL ('e', $file) or die "$file doesn't exist!"; $stat = statL ($file) or die ("unable to get stat for $file ($^E)"); # this test for directory $stat->{mode} & S_IFDIR ? print "Directory\n" : print "File\n" +; # is the same as this one $stat->{attribs} & FILE_ATTRIBUTE_DIRECTORY ? print "Directory +\n" : print "File\n"; # show file times as local time printf "Created: %s\nAccessed: %s\nModified: %s\n", scalar localtime $stat->{ctime}, scalar localtime $stat->{atime}, scalar localtime $stat->{mtime}; my $access_age = -M $basename; return if ( $access_age > $days ); print "$file\n"; printf "$basename: M age in days: %.4f\n\n", $access_age; say "ref to file is $ref_to_file"; } __END__ C:\Users\Fred>perl virus6.pl Can't locate Win32/LongPath.pm in @INC (you may need to install the Wi +n32::LongPath module) (@INC contains: C:\Users\Fred\Documents\perl5\l +ib\perl5/5.24.0/MSWin32-x64-multi-thread C:\Users\Fred\Documents\perl +5\lib\perl5/5.24.0 C:\Users\Fred\Documents\perl5\lib\perl5/MSWin32-x6 +4-multi-thread C:\Users\Fred\Documents\perl5\lib\perl5 C:\Users\Fred\ +perl5\lib\perl5/5.24.0/MSWin32-x64-multi-thread C:\Users\Fred\perl5\l +ib\perl5/5.24.0 C:\Users\Fred\perl5\lib\perl5/MSWin32-x64-multi-threa +d C:\Users\Fred\perl5\lib\perl5 C:/Strawberry/perl/site/lib C:/Strawb +erry/perl/vendor/lib C:/Strawberry/perl/lib .) at virus6.pl line 22. BEGIN failed--compilation aborted at virus6.pl line 22. C:\Users\Fred>

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1178045]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2024-04-19 21:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found