Transforming a directory for a UNIX file

zhaozj2021-02-16  101

#! / usr / bin / perl -w

OpenDIR awir, "."; @ filename = readdir; # print join ("/ n", @FileName); Foreach $ fname (@filename) {if ($ fname = ~ / 帖子) {Next } My $ tmpfilename = "$ fname.tmp.tmp.tmp"; Open srcfile, "<$ fname"; Open TMPFILE, "> $ TMPFILENAME"; WHILE

)

{

IF ($ _ = ~ / ^(./R/N)

{

Print TmpFile $ 1. "/ n";

}

Else

{

Print tmpfile $ _;

}

}

Close Srcfile;

Close tmpfile;

My @filestatus = stat ($ fname);

CHMOD ($ FILESTATUS [2], $ TMPFILENAME);

Chown ($ FILESTATUS [4], $ FILESTATUS [5], $ TMPFILENAME);

# Delete Srcfile

Unlink ($ fname);

`MV $ TMPFILENAME $ FNAME`;

}

`rm * .tmp.tmp.tmp`;

CloseDir (TwId);

转载请注明原文地址:https://www.9cbs.com/read-10648.html

New Post(0)