Advertisement

03.22.2007 at 04:28PM PDT, ID: 22467145
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

xcopy gives invalid drive specification

Tags: drive, xcopy, invalid, specification
Hello,

I am still kinda of new to PERL programming, and need some help with system commands, pipes, and network shares / drives on Windows.  I am trying to XCOPY a file to a network drive or share, but I am getting "Invalid Drive Specification" when I run the script from CGI.  If I drop down to command line, and simply DOS XCOPY the files, it works fine.

What do I need to specify for PERL so that it KNOWS about my network drives and shares?  Why is it that when I try it from DOS it works fine, but when I run it from my script it fails with "Invalid Drive Specification"?

        my $cmd = 'xcopy '.$datafile.' '.$mailpickup.'';
        local *ALERTOUT = IO::File->new_tmpfile;
        local *ALERTERR = IO::File->new_tmpfile;
        local *ALERTIN = IO::File->new_tmpfile;
        my $pid = open3(">&ALERTIN", \*ALERTOUT, ">&ALERTERR", $cmd);

I am using IPC::Open3 to make the system calls and read the STDOUT & STDERR into arrays for parsing so I can check the results of the operation.  I can post the rest of code if needed, but I've tried replacing the $CMD arguments with something simple like "dir" and it works fine, no errors.  So I think it's got something to do with the network aware drives and shares available to PERL, please help...

Thanks in advance,
G
Start your free trial to view this solution
Question Stats
Zone: Programming
Question Asked By: ghosting
Solution Provided By: clockwatcher
Participating Experts: 3
Solution Grade: A
Views: 66
Translate:
Loading Advertisement...
03.22.2007 at 04:42PM PDT, ID: 18775921

Rank: Wizard

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.22.2007 at 05:04PM PDT, ID: 18776085

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.22.2007 at 06:05PM PDT, ID: 18776511

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.22.2007 at 07:39PM PDT, ID: 18777233

Rank: Guru

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.23.2007 at 10:56AM PDT, ID: 18781757

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
Microsoft
  • Internet Protocols
  • Applications
  • Development
  • OS
  • Hardware
  • Windows Security
Apple
  • Operating Systems
  • Hardware
  • Programming
  • Networking
  • Software
Internet
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Spy / Ad Blockers
  • Web Browsers
  • New Net Users
  • Web Development
  • Chat / IM
  • Anti Spam
  • Web Servers
  • Anti-Virus
  • Email Clients
Gamers
  • Tips
  • Online / MMORPG
  • Puzzle
  • Emulators
  • Action / Adventure
  • Role Playing
  • Consoles
  • Game Programming
  • Strategy
  • Sports
  • Misc
  • Computer Games
Digital Living
  • Hardware
  • New Net Users
  • New Users
  • Software
  • Digital Music
  • Gaming World
  • Home Security
  • Apple
  • Networking Hardware
Virus & Spyware
  • Vulnerabilities
  • IDS
  • Encryption
  • Anti-Virus
  • Operating Systems Security
  • Software Firewalls
  • WebApplications
  • Cell Phones
  • Operating Systems
  • Internet
  • Hardware Firewalls
Hardware
  • Handhelds / PDAs
  • Displays / Monitors
  • Components
  • Networking Hardware
  • Peripherals
  • Laptops/Notebooks
  • Storage
  • Servers
  • Desktops
  • New Users
  • Misc
  • Apple
Software
  • System Utilities
  • Industry Specific
  • Network Management
  • Photos / Graphics
  • Page Layout
  • VMWare
  • Misc
  • Web Development
  • OS
  • CYGWIN
  • Voice Recognition
  • Message Queue
  • Quality Assurance
  • Security
  • Firewalls
  • MultiMedia Applications
  • Development
  • Database
  • Office / Productivity
  • Business Management
  • OS/2 Apps
  • Server Software
  • Internet / Email
ITPro
  • OS
  • Storage
  • Encryption
  • Operating Systems Security
  • Apple Hardware
  • Laptops & Notebooks
  • Servers
  • Networking Hardware
  • Peripherals
  • Devices
  • Displays / Monitors
  • WebTrends / Stats
  • Search Engines
  • Firewalls
  • WebApplications
  • IDS
  • Vulnerabilities
  • Email Clients
  • File Sharing
  • Spy / Ad Blockers
  • Web Browsers
  • Web Servers
  • Networking
  • Anti-Virus
  • Chat / IM
  • Anti Spam
Developer
  • Web Servers
  • Web Browsers
  • Game Programming
  • Dev Tools
  • Industry Specific
  • Office / Productivity
  • Database
  • CYGWIN
  • Web Development
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Programming
  • Content Management
  • Application Servers
  • Protocols
Storage
  • Removable Backup Media
  • Storage Technology
  • Servers
  • Grid
  • Remote Access
  • Backup / Restore
  • Misc
  • Hard Drives
OS
  • Miscellaneous
  • Security
  • Development
  • Linux
  • VMWare
  • MainFrame OS
  • Unix
  • Apple
  • OS / 2
  • AS / 400
  • BeOS
  • Microsoft
  • VMS / OpenVMS
Database
  • Oracle
  • Miscellaneous
  • MySQL
  • Software
  • Sybase
  • Contact Management
  • PostgreSQL
  • Data Manipulation
  • Clarion
  • InterSystems Cache
  • Siebel
  • MUMPS
  • OLAP
  • SQLBase
  • SAS
  • GIS & GPS
  • 4GL
  • Berkeley DB
  • DB2
  • Informix
  • Interbase / Firebird
  • FoxPro
  • Reporting
  • LDAP
  • Filemaker Pro
  • MS SQL Server
  • dBase
  • MS Access
Security
  • Misc
  • Web Browsers
  • Software Firewalls
  • Operating Systems Security
  • File Sharing
  • Spy / Ad Blockers
  • Vulnerabilities
  • WebApplications
  • IDS
  • Anti-Virus
  • Encryption
  • Anti Spam
  • Email Clients
  • VPN
  • Chat / IM
Programming
  • Editors IDEs
  • Installation
  • Handhelds / PDAs
  • Multimedia Programming
  • System / Kernel
  • Algorithms
  • Game
  • Signal Processing
  • Project Management
  • Open Source
  • Database
  • Misc
  • Languages
  • Processor Platforms
  • Theory
Web Development
  • Scripting
  • Blogs
  • Web Servers
  • Software
  • Search Engines
  • Web Graphics
  • Images
  • Internet Marketing
  • Images and Photos
  • Components
  • Document Imaging
  • Web Languages/Standards
  • Illustration
  • WebApplications
  • Fonts
  • WebTrends / Stats
  • Authoring
  • Digital Camera Software
  • Miscellaneous
Networking
  • Protocols
  • Apple Networking
  • Network Management
  • Message Queue
  • Application Servers
  • Content Management
  • File Servers
  • Email Servers
  • Misc
  • Java Editors & IDEs
  • Wireless
  • Networking Hardware
  • Backup / Restore
  • System Utilities
  • ISPs & Hosting
  • Web Servers
  • Storage Technology
  • Removable Backup Media
  • Servers
  • Broadband
  • Grid
  • OS / 2
  • Novell Netware
  • Unix Networking
  • Windows Networking
  • Security
  • Telecommunications
  • Operating Systems
  • Linux Networking
Other
  • Community Advisor
  • Lounge
  • Community Support
  • New Net Users
  • Philosophy / Religion
  • Math / Science
  • Miscellaneous
  • URLs
  • Expert Lounge
  • Politics
  • Puzzles / Riddles
Community Support
  • Suggestions
  • New to EE
  • New Topics
  • Community Advisor
  • CleanUp
  • Announcements
  • General
  • Feedback
  • Input
  • EE Bugs
 
03.22.2007 at 04:42PM PDT, ID: 18775921

Rank: Wizard

How do you specify the netowork drive letter? You may need to say something like
 xcopy F:\\some\\file.txt G:\\other\\file.txt

The following gives more detail
http://aspn.activestate.com/ASPN/docs/ActivePerl/5.8/faq/Windows/ActivePerl-Winfaq8.html#When_I_try_to_open_a_file_I_get
 
03.22.2007 at 05:04PM PDT, ID: 18776085
I am not convinced this is the problem, the single quote vs double quote issue with escaping the "\" character.  To be sure, I had my subroutine print out the $CMD argument to the browser, to check what was being escaped...

xcopy C:\XAOSys\var\www\linepull\config\Error_report.txt \\erp2\pickup\

is the actual output I am getting from my routine.  Yet I still get invalid drive specification... WHY?
I was well aware of the "\" escaping, my editor warns me if I don't properly escape and close something in quotes, single or double.  I use eclipse, http://e-p-i-c.sourceforge.net/ which ROCKS!

I've got to wrap up for today, but any suggestions on how or why this doesn't work and what to make it work, would be most appreciated.  

Thanks for all your responses,
G
 
03.22.2007 at 06:05PM PDT, ID: 18776511
I agree with teraplane it is probably an escaping issue.
In any case, the perlscript is fine as I have posted it below -- as in, it works.
I suggest you use the below and replace test.txt with your file, and compy and share with the appropriate data.  If it still fails you need to look at your perl installation, your windows installation. but there is no point in looking further at the script. It works.


use IO::FILE;
use IPC::Open3;

$datafile = "C:\\test.txt";
$mailpickup = "\\\\compy\\share\\";

my $cmd = 'xcopy ' . $datafile . ' ' . $mailpickup;

        local *ALERTOUT = IO::File->new_tmpfile;
        local *ALERTERR = IO::File->new_tmpfile;
        local *ALERTIN = IO::File->new_tmpfile;
        my $pid = open3(">&ALERTIN", \*ALERTOUT, ">&ALERTERR", $cmd);


 
03.22.2007 at 07:39PM PDT, ID: 18777233

Rank: Guru

If the path isn't the problem then it's probably a permissions problem.   Which webserver are you using?

If you're running IIS and you haven't changed the IIS authentication method for the script (or more typically the directory housing your script), it will be running as a local user account (IUSR_Machinename) and that local user account won't have access to the network.    To change it,  from the IIS MMC navigate to the folder housing your script, right-click (either the directory or the script itself), select Properties, File (or Directory) Security Tab, Anonymous access and authentication control section Edit.., and change the account used for anonymous access to a network account.

If you're using Apache, you'd need to change the service so it's running as an account with network permissions (rather than the LocalSystem account which is the default).  Control Panel, Admin Tools, Services, Apache, right-click, Properties, Log On.
Accepted Solution
 
03.23.2007 at 10:56AM PDT, ID: 18781757
Thanks clockwatcher,

It totally was IIS, darn it!  I simply changed the permissions to run as a standard domain admin with rights to all my network shares, viola!  A little scary, so I think I'll create a Power User or Backup operator and make that user my IIS anonymous user, since I need access to several domains for my archiving project.

Thanks and have a good one...
G
 
 
20080236-EE-VQP-29