Saadat Saeed wrote:
> Hello, now I am a newbie to perl & would like to
> migrate my existing knowledge...
Don't bother. Perl has its own internal structure and logic, and
can do a simple file-search with much less overhead.
opendir BASE_DIR, $base_folder;
while (my $filename = <BASE_DIR>) {
next if $filename eq '.' or $filename eq '..';
mkdir "$target_folder/$filename" if -d "$base_folder/$filenam"
and not -e "$target_folder/$filename";
}
perldoc -f opendir
perldoc -f -e # This also covers the ther -X file test functions
>
>
> Would anypone give me a crash course here... how would
> my following short vbscript correspond in perl.????
It wouldn't really. Perl doesn't burden simple operations with such
homage to the brass idol of OO.
>
>
> Set objShell = CreateObject ("Shell.Application")
> Set objFSO =
> CreateObject("Scripting.FileSystemObject")
> strFolder = "s:\Filing 2003"
> strFolder2 = "s:\Filing 2004\"
> Set objFolder = objShell.Namespace (strFolder)
> For Each strFileName in objFolder.Items
Bad naming choice, even in VBScript. If it has dot-addressable
members, then it should not have an str prefix, if you are using
Hungarian notation. It should probably be something like fso or
fil, or, what the hell, how about file_? [oops, guess that last
wasn't proper Hungarian, huh?]
>
> If strFileName.Type = "File Folder" Then
> Set objFolder = objFSO.CreateFolder(strFolder2 &
> strFileName.Name)
> End If
> Next
>
> Have a happy new year!
... and welcome to Perl. It is a very straightforward language,
designed to allow for very natural expression. As you explore it,
focus on making a clear and direct statement of what you wish to
accomplish. As you do this, you will find that your code will
pretty much write itself.
Joseph
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>