GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Perl script question
Operating System - HP-UX
1849374
Members
6802
Online
104044
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2003 03:22 AM
11-03-2003 03:22 AM
Perl script question
Hi everyone,
I need to do some modification in perl script here's the syntex
if ($ftpid eq "zzz"){
foreach $file (@{$ftpFileL{$ftpid}}){
$basename = basename($file);
copy($file,"./$basename.$mydate[4]$mydate[3]$mydate[5]");
}
}
Right now we are putting the time stamp on each file but for 4 specific files we don't want to put time stamp and for other we want. So can someone help me out here.
Thanks
I need to do some modification in perl script here's the syntex
if ($ftpid eq "zzz"){
foreach $file (@{$ftpFileL{$ftpid}}){
$basename = basename($file);
copy($file,"./$basename.$mydate[4]$mydate[3]$mydate[5]");
}
}
Right now we are putting the time stamp on each file but for 4 specific files we don't want to put time stamp and for other we want. So can someone help me out here.
Thanks
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2003 03:30 AM
11-03-2003 03:30 AM
Re: Perl script question
Why not keep a hash of filenames instead of an array and then just delete the ones you dont want to process.
Load you hash with $filename{$file}=$file;
delete them with something like delete $filename{myfile1};delete $filename{myfile2} etc;
go through them with
foreach $hashfile ( keys %filenames){
do something with $hashfile which is the name of the file
}
Just a thought
Load you hash with $filename{$file}=$file;
delete them with something like delete $filename{myfile1};delete $filename{myfile2} etc;
go through them with
foreach $hashfile ( keys %filenames){
do something with $hashfile which is the name of the file
}
Just a thought
Never preceed any demonstration with anything more predictive than "watch this"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2003 03:35 AM
11-03-2003 03:35 AM
Re: Perl script question
Slight change will do the job:
if ($ftpid eq "zzz"){
foreach $file (@{$ftpFileL{$ftpid}}){
$basename = basename($file);
$filename = "./$basename"
if ( condition for these 4 files){
else
$filename = "./$filename.$mydate[4]$mydate[3]$mydate[5]");
}
copy($file,"$filename");
}
}
You will have to play a bit to get it to work.
SEP
if ($ftpid eq "zzz"){
foreach $file (@{$ftpFileL{$ftpid}}){
$basename = basename($file);
$filename = "./$basename"
if ( condition for these 4 files){
else
$filename = "./$filename.$mydate[4]$mydate[3]$mydate[5]");
}
copy($file,"$filename");
}
}
You will have to play a bit to get it to work.
SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2026 Hewlett Packard Enterprise Development LP