【发布时间】:2016-04-29 01:02:40
【问题描述】:
首先,我不是 perl 程序员,但我知道足够危险......
我购买了一个拍卖脚本,其中有脚本卖家拒绝处理的问题。
有一个auctiondata 文件夹,其中包含所有类别文件夹,包括物品出售时的关闭文件夹。当一个项目被发布时,它进入一个类别文件夹,当它出售时,它应该被移动到关闭的文件夹中,但是一个副本被移动到关闭的文件夹中,原始文件留在它的类别文件夹中。
这会导致软件错误,直到从类别文件夹中删除有问题的文件。
所以我想知道是否有人可以帮助我编写一个搜索所有类别文件夹的脚本,并且文件名与关闭文件夹中的文件匹配的任何文件都将被删除。
我自己尝试过,但都失败了。
buyit.pl页面上的代码如下...
##############################################
# Sub: Close Auction now
# This sets an item's status to closed.
sub closebuyit {
if ($form{'CATEGORY'},$form{'ITEM'} ne $config{'closedir'}) {
if ($config{'closedir'}) {
umask(000); # UNIX file permission junk
mkdir("$config{'basepath'}$config{'closedir'}", 0777) unless (-d "$config{'basepath'}$config{'closedir'}");
print "Please notify the site admin that this item cannot be copied to the closed directory even though it is closed.\n"
unless &movefile("$config{'basepath'}$form{'CATEGORY'}/$form{'ITEM'}.dat", "$config{'basepath'}$config{'closedir'}/$form{'CATEGORY'}$form{'ITEM'}.dat");
unlink("$config{'basepath'}askseller/$form{'ITEM'}.dat");
unlink("$config{'basepath'}$config{'countdir'}/$form{'ITEM'}.dat");
}
else {
print "Please notify the site admin that this item cannot be removed even though it is closed.\n" unless unlink("$config{'basepath'}$form{'CATEGORY'}/$form{'ITEM'}.dat");
}
}
}
################################################
1;
这应该将文件从类别文件夹移动到关闭的文件夹,但没有。文件夹的权限是755,但是里面创建的文件是644。
提前感谢您的帮助!
【问题讨论】:
-
您是否得到任何这些打印件(“请通知...”)?有输出吗?有什么错误吗?
标签: perl perl-module