08-14-2011
modifying the above from birei to account for path:
$ for image in /home/sitename.com/www/photos/*.jpg; do cp "$image" "${image/new/old}"; done
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
When I do the following :
grep -l "string" *,
I get a list of file names returned. Is there a way to copy the files returned from the list into another directory ?.
Thanks. (4 Replies)
Discussion started by: Kartheg
4 Replies
2. UNIX for Dummies Questions & Answers
Hi,
I have to copy a set of files abc* in /path/ to /path1/ as abc*_bkp.
The list of files appear as follows in /path/:
abc1
xyszd
abc2
re2345
abcx
..
.
abcxyz
I have to copy them (abc* files only) into /path1/ as:
abc1_bkp
abc2_bkp
abcx_bkp
..
. (6 Replies)
Discussion started by: new_learner
6 Replies
3. UNIX for Dummies Questions & Answers
I have two servers. I would like to copy some files from one directory on server A into the same directory on server B.
Its not all the files in in the directory, just some of them.
Is there a way to make a file list in a txt file and then somehow copy all the files in that list in one go to... (6 Replies)
Discussion started by: Sepia
6 Replies
4. UNIX for Dummies Questions & Answers
hi,
I am copying a file from 1 folder to another in /bin/sh. if the file already exists there, it should get copied as filename1. again if copying next time it shouldget copied as filename2.. , filename3..so on..
The problem is i am able to get uptil filename1.. but how do i know what... (6 Replies)
Discussion started by: blackcat
6 Replies
5. Shell Programming and Scripting
Hi,
I have a list of zipped files. I want to grep for a string in all files and get a list of file names that contain the string. But without unzipping them before that, more like using something like gzcat.
My OS is:
SunOS test 5.10 Generic_142900-13 sun4u sparc SUNW,SPARC-Enterprise (8 Replies)
Discussion started by: apenkov
8 Replies
6. Shell Programming and Scripting
I'm trying to find a Bourne shell script that will copy files from one directory using a wild card for the file name (*) and add some more characters in the middle of the file name as it is copied. As an example:
/u01/tmp-file1.xml => /u02/tmp-file1-20130620.xml
/u01/tmp-file2.xml => ... (6 Replies)
Discussion started by: Tony Keller
6 Replies
7. Shell Programming and Scripting
Data files coming in different names in a file name called process.txt.
1. shipments_yyyymmdd.gz
2 Order_yyyymmdd.gz
3. Invoice_yyyymmdd.gz
4. globalorder_yyyymmdd.gz
The process needs to discard all the below files and only process two of the 4 file names available
... (1 Reply)
Discussion started by: dsravanam
1 Replies
8. Shell Programming and Scripting
Hi, I have a control file which will contain all filenames(300) files. Loop through all the file names in the control files and check the existence of this file in another directory(same server). I need to infinitely(2 hrs) run this while loop until all the files are found. Once a file is found,... (5 Replies)
Discussion started by: laknar
5 Replies
9. Shell Programming and Scripting
I'm interested in writing a report script using BASH that searches all of the files in a particular directory for a keyword and printing a list of files containing this string...
In fact this reporting script would have searches for multiple keywords, so I'm interested in making multiple... (2 Replies)
Discussion started by: chemscripter904
2 Replies
10. Shell Programming and Scripting
Hi ,
I'm trying to list the files and output is written to a file. But when I execute the command , the output file is being listed. How to exclude it ?
/tmp
file1.txt
file2.txt
ls -ltr |grep -v '-' | awk print {$9, $5} > output.txt
cat output.txt
file1.txt
file2.txt
output.txt (8 Replies)
Discussion started by: etldeveloper
8 Replies
LEARN ABOUT PHP
imagecreatefromstring
IMAGECREATEFROMSTRING(3) 1 IMAGECREATEFROMSTRING(3)
imagecreatefromstring - Create a new image from the image stream in the string
SYNOPSIS
resource imagecreatefromstring (string $image)
DESCRIPTION
imagecreatefromstring(3) returns an image identifier representing the image obtained from the given $image. These types will be automati-
cally detected if your build of PHP supports them: JPEG, PNG, GIF, WBMP, and GD2.
PARAMETERS
o $image
- A string containing the image data.
RETURN VALUES
An image resource will be returned on success. FALSE is returned if the image type is unsupported, the data is not in a recognised for-
mat, or the image is corrupt and cannot be loaded.
EXAMPLES
Example #1
imagecreatefromstring(3) example
<?php
$data = 'iVBORw0KGgoAAAANSUhEUgAAABwAAAASCAMAAAB/2U7WAAAABl'
. 'BMVEUAAAD///+l2Z/dAAAASUlEQVR4XqWQUQoAIAxC2/0vXZDr'
. 'EX4IJTRkb7lobNUStXsB0jIXIAMSsQnWlsV+wULF4Avk9fLq2r'
. '8a5HSE35Q3eO2XP1A1wQkZSgETvDtKdQAAAABJRU5ErkJggg==';
$data = base64_decode($data);
$im = imagecreatefromstring($data);
if ($im !== false) {
header('Content-Type: image/png');
imagepng($im);
imagedestroy($im);
}
else {
echo 'An error occurred.';
}
?>
The above example will output something similar to:[NOT DISPLAYABLE MEDIA]Output of example : imagecreatefromstring()
SEE ALSO
imagecreatefromjpeg(3), imagecreatefrompng(3), imagecreatefromgif(3), imagecreatetruecolor(3).
PHP Documentation Group IMAGECREATEFROMSTRING(3)