Using less exotic languages (*poke*) :
The cut extracts the first character from $file, and the tr transforms it into uppercase. The ${file#?} leaves behind all but the first character in the filename. Double-quotes are used in case the filename has funny characters or spaces.
Hi to everyone!!. Here's my stupid question of the day.
When I have to rename a file I use "mv filename newfilename".
But what about renaming multiple files, for example if I want to add the prefix "old" to several image files (in fact it's what I wanted to do..).
Thanks in advance.... :D (6 Replies)
Help!
I was trying to rename multiple files. Like in DOS, i decided to use wildcards and now i am missing some files. Any ideas on how to recover them? Or find out where the files went?
I had these 3 files
resume1.log
elecresume.log
compresume.log
The command I ran was
mv *.log *.log.bak... (6 Replies)
hi,
I've a machine running RHEL3,kernel version 2.4.
i need to rename multiple files under one directory as follows:
ls
demo.c demo.S demo-1243.sw demo.xyz
and now i need to replace the occurrence of demo with demo_1 for each of the above file. the tedious way is to go ahead and do mv on... (2 Replies)
I have a bunch of files txt1.csv--2008 thru to txt3.csv--2008.
If i wanted to rename these files all at the same time to txt*.csv-2008 what would be the best way to do it...
Just need to get rid of the extra - in each file name.. not all files are going to be called txt*.csv--2008. Just... (6 Replies)
Hi,
I have several hundred files I need to rename, and I'm would rather not hit F2 for each file individually to rename them.
Example of file:
large1961.jpg
What I need the file to be renamed as:
1961.jpg
I don't know what type of command I can execute within a shell script that would... (7 Replies)
Hi,
Can we rename multiples files using find or awk utility?
Now I am doing it using for loop and getting the file name and in side the loop using the mv command.
Like ine need t rename all txt files to doc file. For example
a1.txt => a1.doc
a2.txt => a2.doc
a3.txt => a3.doc
myfile.txt... (2 Replies)
I'm looking for a simple solution to rename a batch of files. All of the files in this directory start with a date in the format mm.dd.yy followed by a space and then additional descriptive text.
Example:
01.21.10 742 P.xlsx
02.24.09 730 Smith.xlsx
The information following the date can... (3 Replies)
I have 34 file in a directory that all have different names, however, they do have 1 pattern in commmon. They all have "-10-11-2010" date format in the name. I want to replace the date in the file name with a supplied date or maybe even the system date. I am sure I will be using awk or sed to... (9 Replies)
Hello, I have multiple files that I want to change the names to. Let's say for example that I want to rename all the files in the left column to the names in the right column:
What would be the easiest way to go about doing this? Thanks. (1 Reply)
Hi,
In sftp script to get files, I have to rename all the files which I am picking. Rename command does not work here. Is there any way to do this?
I am using #!/bin/ksh
For eg: sftp user@host <<EOF
cd /path
get *.txt
rename *.txt *.txt.done
... (7 Replies)
Discussion started by: jhilmil
7 Replies
LEARN ABOUT PHP
imap_createmailbox
IMAP_CREATEMAILBOX(3) 1 IMAP_CREATEMAILBOX(3)imap_createmailbox - Create a new mailboxSYNOPSIS
bool imap_createmailbox (resource $imap_stream, string $mailbox)
DESCRIPTION
Creates a new mailbox specified by $mailbox.
PARAMETERS
o $
imap_stream -An IMAP stream returned by imap_open(3).
o $mailbox
- The mailbox name, see imap_open(3) for more information. Names containing international characters should be encoded by
imap_utf7_encode(3)RETURN VALUES
Returns TRUE on success or FALSE on failure.
EXAMPLES
Example #1
imap_createmailbox(3) example
<?php
$mbox = imap_open("{imap.example.org}", "username", "password", OP_HALFOPEN)
or die("can't connect: " . imap_last_error());
$name1 = "phpnewbox";
$name2 = imap_utf7_encode("phpnewbox"); // phpnewb&w7Y-x
$newname = $name1;
echo "Newname will be '$name1'<br />
";
// we will now create a new mailbox "phptestbox" in your inbox folder,
// check its status after creation and finally remove it to restore
// your inbox to its initial state
if (@imap_createmailbox($mbox, imap_utf7_encode("{imap.example.org}INBOX.$newname"))) {
$status = @imap_status($mbox, "{imap.example.org}INBOX.$newname", SA_ALL);
if ($status) {
echo "your new mailbox '$name1' has the following status:<br />
";
echo "Messages: " . $status->messages . "<br />
";
echo "Recent: " . $status->recent . "<br />
";
echo "Unseen: " . $status->unseen . "<br />
";
echo "UIDnext: " . $status->uidnext . "<br />
";
echo "UIDvalidity:" . $status->uidvalidity . "<br />
";
if (imap_renamemailbox($mbox, "{imap.example.org}INBOX.$newname", "{imap.example.org}INBOX.$name2")) {
echo "renamed new mailbox from '$name1' to '$name2'<br />
";
$newname = $name2;
} else {
echo "imap_renamemailbox on new mailbox failed: " . imap_last_error() . "<br />
";
}
} else {
echo "imap_status on new mailbox failed: " . imap_last_error() . "<br />
";
}
if (@imap_deletemailbox($mbox, "{imap.example.org}INBOX.$newname")) {
echo "new mailbox removed to restore initial state<br />
";
} else {
echo "imap_deletemailbox on new mailbox failed: " . implode("<br />
", imap_errors()) . "<br />
";
}
} else {
echo "could not create new mailbox: " . implode("<br />
", imap_errors()) . "<br />
";
}
imap_close($mbox);
?>
SEE ALSO imap_renamemailbox(3), imap_deletemailbox(3).
PHP Documentation Group IMAP_CREATEMAILBOX(3)