From: Saadat Saeed <[EMAIL PROTECTED]>
> Hello, now I am a newbie to perl & would like to
> migrate my existing knowledge...
>
> Would anypone give me a crash course here... how would
> my following short vbscript correspond in perl.????
>
> Set objShell = CreateObject ("Shell.Application")
> Set objFSO =
> CreateObject("Scripting.FileSystemObject")
1. you do not need any silly objects for the basic operations in
Perl.
> strFolder = "s:\Filing 2003"
> strFolder2 = "s:\Filing 2004\"
$strFolder = "s:\\Filing 2003";
$strFolder2 = "s:\\Filing 2004";
> Set objFolder = objShell.Namespace (strFolder)
opendir DIR, $strFolder
or die "Can't open $strFolder: $!\n";
> For Each strFileName in objFolder.Items
while ($strFileName = readdir DIR) {
> If strFileName.Type = "File Folder" Then
if (-d $strFileName) {
> Set objFolder = objFSO.CreateFolder(strFolder2 &
> strFileName.Name)
mkdir ( "$strFolder2\\$strFileName", 0777)
or die "Failed to create directory $strFileName in
$strFolder2:
$!\n";
> End If
}
> Next
}
closedir DIR;
Jenda
===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>