AznDevil92
AznDevil92

Reputation: 554

Set File Paths - Perl Script

What I am trying to do is take the bcp log file out (log folder) and move it to another directory with a current time (history folder). However, every time I execute this Perl script, it states "No such file or directory at line 18"

Below is my code:

## SET FILE PATHS
my $myBCPDump = "//Server-A/X:/Main Folder/Log/bcpLog.txt";
my $myBCPLog = "//Server-A/X:/Main Folder/History/bcpLog" . $myDate . ".txt"; 

my $isJunk = "rows successfully|rows sent to SQL|packet size|Starting copy|^\n|Clock Time";

open (LOGFILE, ">$myBCPLog") or die $!; ##Line 18

close (LOGFILE);

I know that it can't find the file or directory is because the ##SET FILE PATHS is not being executed properly and I am not sure why.

Upvotes: 0

Views: 540

Answers (1)

ikegami
ikegami

Reputation: 385565

//Server-A/X:/... isn't a valid path in Windows. A colon (:) isn't allowed in a path except after a drive letter (C:...). But you have a UNC path (\\server\share\... aka //server/share/...), and those don't have a drive component. Did you perhaps mean //Server-A/X$/...? If so,

"//Server-A/X:/..."

should be changed to either of

"//Server-A/X\$/..."

and

'//Server-A/X$/...'

Upvotes: 2

Related Questions