I am reaching my wits end. I manage a small website for a friend. They want it on yahoo because it has been there and they have their mail addresses there. Recently something happened that caused updates and backups to stop working. The customer services group has been of no help so i have dug farther myself. I created the following perl program

#!/usr/bin/perl -w use strict; use warnings; use CGI; my $q = CGI->new; print $q->header('text/html'); print "<html><head><title>renamehuh Perl</title></head>\n<body>\n"; print '<h1>Why doesnt this work</h1>'."\n"; print '<pre>'."\n"; my $dir='/saveit/md5test'; use File::Basename; my $file=$dir.'/huh.saveit'; my $dpart=dirname ($file); my $fpart=basename($file); my $nback=5; if ($nback){ if (-e $dpart.'/bkup'.$nback.'-'.$fpart) { unlink $dpart.'/bkup' +.$nback.'-'.$fpart; } for (;$nback>1;$nback--){ my $nback1=$nback-1; my $thisfn=$dpart.'/bkup'.$nback1.'-'.$fpart; if (-e $thisfn) { myrename ($thisfn,$dpart.'/bkup'.$nback.'-'. +$fpart);} } if (-e $file) { myrename ($file,$dpart.'/bkup'.$nback.'-'.$fpart +); } } #nback open (my $out,'>',$file); my $time=time; print $out "hi $time\n"; close $out; use HTML::Entities qw/encode_entities/; print "\n\n<hr> perl program is $0 \n"; open (my $iam,'<',$0); while (my $line=<$iam>){ chomp $line; print encode_entities($line)."\n"; } exit; sub myrename{ my $thisfn=shift; my $newfn=shift; print " \n"; if (-f $thisfn) {print "$thisfn exists \n";} print "rename $thisfn,$newfn\n"; my $ok=rename $thisfn,$newfn; unless ($ok) {print "Cant rename $thisfn $newfn $!\n";} unless (-e $newfn) {print " .. $newfn doesnt exist \n";} return $ok; } #
When i run that program i get the following result.
/saveit/md5test/huh.saveit exists rename /saveit/md5test/huh.saveit,/saveit/md5test/bkup1-huh.saveit Cant rename /saveit/md5test/huh.saveit /saveit/md5test/bkup1-huh.savei +t No such file or directory .. /saveit/md5test/bkup1-huh.saveit doesnt exist
As you can see the my $ok=rename $thisfn,$newfn; is returning false and presenting "No such file or directory" in $!.

Customer service tried to tell me that it is because of .htaccess files. I find this hard to believe. Anyway for some reason yahoo is hiding dot-files from me via SFTP WINscp (also a FTP manager) and filezilla and their online file manager so i cannot remove them, and unlink/rename isnt working on them either

Does anyone have any ideas (besides yahoo being hosed) that could help me?

The base code is part of a backup procedure of mine that keeps prior copies in files named bkup1-huh.saveit, bkup2-huh.saveit, bkup3-huh.saveit ,bkup4-huh.saveit ,bkup5-huh.saveit. It works on 3 other linux boxes and about 4 windows boxes just fine, but not at yahoo.

If i run  unlink $file; on yahoo i get the same false result and error in $!

Edit: the permissions on the file are 664, i tried 777 but it made no difference, when i create the file via the web or FTP the uid/gid look the same as any other file on the website too


In reply to problems with basic perl/unix commands on yahoo small business services by huck

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.